Package weibo4j.model

Examples of weibo4j.model.WeiboException


      parts[parts.length - 1] = filePart;

      postMethod.setRequestEntity(new MultipartRequestEntity(parts, postMethod.getParams()));
      return httpRequest(postMethod);
    } catch (Exception ex) {
      throw new WeiboException(ex.getMessage(), ex, -1);
    }
  }
View Full Code Here


      if (responseCode != OK)

      {
        try {
          throw new WeiboException(getCause(responseCode), response.asJSONObject(), method
              .getStatusCode());
        } catch (JSONException e) {
          e.printStackTrace();
        }
      }
      return response;

    } catch (IOException ioe) {
      throw new WeiboException(ioe.getMessage(), ioe, responseCode);
    } finally {
      method.releaseConnection();
    }

  }
View Full Code Here

        stream.close();
        con.disconnect();
        streamConsumed = true;
      } catch (NullPointerException npe) {
        // don't remember in which case npe can be thrown
        throw new WeiboException(npe.getMessage(), npe);
      } catch (IOException ioe) {
        throw new WeiboException(ioe.getMessage(), ioe);
      }
    }
    return responseAsString;
  }
View Full Code Here

        // it should be faster to read the inputstream directly.
        // but makes it difficult to troubleshoot
        this.responseAsDocument =
            builders.get().parse(new ByteArrayInputStream(asString().getBytes("UTF-8")));
      } catch (SAXException saxe) {
        throw new WeiboException("The response body was not well-formed:\n" + responseAsString,
            saxe);
      } catch (IOException ioe) {
        throw new WeiboException("There's something with the connection.", ioe);
      }
    }
    return responseAsDocument;
  }
View Full Code Here

   */
  public JSONObject asJSONObject() throws WeiboException {
    try {
      return new JSONObject(asString());
    } catch (JSONException jsone) {
      throw new WeiboException(jsone.getMessage() + ":" + this.responseAsString, jsone);
    }
  }
View Full Code Here

   */
  public JSONArray asJSONArray() throws WeiboException {
    try {
      return new JSONArray(asString());
    } catch (Exception jsone) {
      throw new WeiboException(jsone.getMessage() + ":" + this.responseAsString, jsone);
    }
  }
View Full Code Here

      accessToken = json.getString("access_token");
      expireIn = json.getString("expires_in");
      refreshToken = json.getString("refresh_token");
      uid = json.getString("uid");
    } catch (JSONException je) {
      throw new WeiboException(je.getMessage() + ":" + json.toString(), je);
    }
  }
View Full Code Here

  public Boolean destroyFavoritesBatch(String ids) throws WeiboException {
    try {
      return client.post(WeiboConfig.getValue("baseURL") + "favorites/destroy_batch.json",
          new PostParameter[] {new PostParameter("ids", ids)}).asJSONObject().getBoolean("result");
    } catch (JSONException e) {
      throw new WeiboException(e);
    }
  }
View Full Code Here

  public Boolean destroyFavoritesTagsBatch(String ids) throws WeiboException {
    try {
      return client.post(WeiboConfig.getValue("baseURL") + "favorites/destroy_batch.json",
          new PostParameter[] {new PostParameter("ids", ids)}).asJSONObject().getBoolean("result");
    } catch (JSONException e) {
      throw new WeiboException(e);
    }
  }
View Full Code Here

      expireIn = json.getString("expires_in");
      // Fix issue #1, see https://github.com/belerweb/weibo4j/issues/1
      // refreshToken = json.getString("refresh_token");
      uid = json.getString("uid");
    } catch (JSONException je) {
      throw new WeiboException(je.getMessage() + ":" + json.toString(), je);
    }
  }
View Full Code Here

TOP

Related Classes of weibo4j.model.WeiboException

Copyright © 2018 www.massapicom. 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.