示例#1
0
  /**
   * Opens the request authorization web page in the default browser.
   *
   * @param token The authentication token
   * @throws TMDbResponseException Throws whether the server response is not a success.
   */
  public static void showRequestAuthorization(TMDbToken token) throws TMDbResponseException {
    try {

      URI url = new URI(TMDbURLCreator.getRequestAuthorizationUrl(token.getValue()).toString());
      Desktop.getDesktop().browse(url);

    } catch (MalformedURLException e) {
      Log.print(e);

      throw new TMDbResponseException(TMDbStatus.MALFORMED_URL);
    } catch (URISyntaxException e) {
      Log.print(e);

      throw new TMDbResponseException(TMDbStatus.MALFORMED_URL);
    } catch (IOException e) {
      Log.print(e);

      throw new TMDbResponseException(TMDbStatus.UNKNOWN_ERROR);
    }
  }
示例#2
0
  /** Parses the origin JSON object. */
  private boolean parseJSON(JSONObject json) {

    if (json.isNullObject()) return false;

    setSize(json.getString(TMDbConstants.SIZE));

    try {
      setLink(new URL(json.getString(TMDbConstants.LINK)));
    } catch (MalformedURLException e) {
      Log.print(e);
    }

    return true;
  }