Examples of GitHubException


Examples of com.github.api.v2.services.GitHubException

   */
  protected JsonElement unmarshallList(InputStream jsonContent) {
        try {
          return parser.parse(new InputStreamReader(jsonContent, UTF_8_CHAR_SET));
        } catch (Exception e) {
            throw new GitHubException(e);
        } finally {
          closeStream(jsonContent);
      }
  }
View Full Code Here

Examples of com.github.api.v2.services.GitHubException

          request.connect();
          maxRateLimit = request.getHeaderFieldInt(ApplicationConstants.MAX_RATE_LIMIT_HEADER, -1);
          currentRateLimit = request.getHeaderFieldInt(ApplicationConstants.CURRENT_RATE_LIMIT_HEADER, -1);
         
          if (request.getResponseCode() != expected) {
              throw new GitHubException(convertStreamToString(getWrappedInputStream(request.getErrorStream(),
                        GZIP_ENCODING.equalsIgnoreCase(request.getContentEncoding()))));
          } else {
              return getWrappedInputStream(request.getInputStream(),
                                           GZIP_ENCODING.equalsIgnoreCase(request.getContentEncoding()));
          }
      } catch (IOException e) {
          throw new GitHubException(e);
      }
  }
View Full Code Here

Examples of com.github.api.v2.services.GitHubException

            request.connect();
          maxRateLimit = request.getHeaderFieldInt(ApplicationConstants.MAX_RATE_LIMIT_HEADER, -1);
          currentRateLimit = request.getHeaderFieldInt(ApplicationConstants.CURRENT_RATE_LIMIT_HEADER, -1);
           
            if (request.getResponseCode() != expected) {
              throw new GitHubException(convertStreamToString(getWrappedInputStream(request.getErrorStream(),
                        GZIP_ENCODING.equalsIgnoreCase(request.getContentEncoding()))));
            } else {
                return getWrappedInputStream(request.getInputStream(),
                        GZIP_ENCODING.equalsIgnoreCase(request.getContentEncoding()));
            }
    } catch (IOException e) {
      throw new GitHubException(e);
    } finally {
    }
  }
View Full Code Here

Examples of com.github.api.v2.services.GitHubException

          maxRateLimit = request.getHeaderFieldInt(ApplicationConstants.MAX_RATE_LIMIT_HEADER, -1);
          currentRateLimit = request.getHeaderFieldInt(ApplicationConstants.CURRENT_RATE_LIMIT_HEADER, -1);
         
         
          if (request.getResponseCode() != expected) {
              throw new GitHubException(convertStreamToString(getWrappedInputStream(request.getErrorStream(),
                        GZIP_ENCODING.equalsIgnoreCase(request.getContentEncoding()))));
          } else {
              return getWrappedInputStream(request.getInputStream(),
                                           GZIP_ENCODING.equalsIgnoreCase(request.getContentEncoding()));
          }
      } catch (IOException e) {
          throw new GitHubException(e);
      }
  }
View Full Code Here

Examples of com.github.api.v2.services.GitHubException

          request.connect();
          maxRateLimit = request.getHeaderFieldInt(ApplicationConstants.MAX_RATE_LIMIT_HEADER, -1);
          currentRateLimit = request.getHeaderFieldInt(ApplicationConstants.CURRENT_RATE_LIMIT_HEADER, -1);
         
          if (request.getResponseCode() != expected) {
              throw new GitHubException(convertStreamToString(getWrappedInputStream(request.getErrorStream(),
                        GZIP_ENCODING.equalsIgnoreCase(request.getContentEncoding()))));
          } else {
              return getWrappedInputStream(request.getInputStream(),
                                           GZIP_ENCODING.equalsIgnoreCase(request.getContentEncoding()));
          }
      } catch (IOException e) {
          throw new GitHubException(e);
      }
  }
View Full Code Here

Examples of com.github.api.v2.services.GitHubException

      String response = convertStreamToString(callApiGet(builder.buildUrl()));
      Matcher matcher = ApplicationConstants.ACCESS_TOKEN_PATTERN.matcher(response);
      if (matcher.find()) {
              return matcher.group(1);
            } else {
              throw new GitHubException(response);
            }
    } catch (Exception e) {
      throw new GitHubException(e);
    }
  }
View Full Code Here

Examples of com.github.api.v2.services.GitHubException

        try {
          JsonElement element = parser.parse(new InputStreamReader(jsonContent, UTF_8_CHAR_SET));
          if (element.isJsonObject()) {
            return element.getAsJsonObject();
          } else {
            throw new GitHubException("Unknown content found in response." + element);
          }
        } catch (Exception e) {
            throw new GitHubException(e);
        } finally {
          closeStream(jsonContent);
      }
  }
View Full Code Here

Examples of com.github.api.v2.services.GitHubException

        try {
          JsonElement element = parser.parse(new InputStreamReader(jsonContent, UTF_8_CHAR_SET));
          if (element.isJsonArray()) {
            return element.getAsJsonArray();
          } else {
            throw new GitHubException("Unknown content found in response." + element);
          }
        } catch (Exception e) {
            throw new GitHubException(e);
        } finally {
          closeStream(jsonContent);
      }
  }
View Full Code Here

Examples of com.github.api.v2.services.GitHubException

        JsonObject response = unmarshall(callApiGet(apiUrl));
      if (response.isJsonObject()) {
        JsonObject json = response.getAsJsonObject();
        int status = json.get("responseStatus").getAsInt();
        if (status != 200) {
          throw new GitHubException(json.get("responseDetails").getAsString());
        }
        JsonElement data = json.get("responseData");
        if (data != null) {
              return unmarshall(new TypeToken<Feed>(){}, data.getAsJsonObject().get("feed"));
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.