Example usage for twitter4j TwitterException toString

List of usage examples for twitter4j TwitterException toString

Introduction

In this page you can find the example usage for twitter4j TwitterException toString.

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:hashimotonet.UpdateStatus.java

License:Apache License

/**
 * Twitter?//www . j av a 2 s  .  c  om
 * @throws TwitterException 
 */
private void connectTwitter() throws TwitterException {
    // Twitetr4j??
    Configuration conf = ConfigurationContext.getInstance();
    // OauthF?IuWFNg??
    OAuthAuthorization Oauth = new OAuthAuthorization(conf);
    // OauthF?IuWFNgconsumerKeyconsumerSecret?
    Oauth.setOAuthConsumer(Globals.KEY, Globals.SECRET);

    //       // NGXgg?[N??
    RequestToken sRequestToken = null;
    try {
        sRequestToken = Oauth.getOAuthRequestToken();
    } catch (TwitterException e) {
        throw new TwitterException(e.toString());
    }
    String url = sRequestToken.getAuthorizationURL();
    System.out.println("Url = " + url);
}

From source file:net.lacolaco.smileessence.twitter.task.BlockTask.java

License:Open Source License

@Override
protected User doInBackground(Void... params) {
    try {/*from ww  w  .  j a  va 2 s.co  m*/
        return twitter.users().createBlock(userID);
    } catch (TwitterException e) {
        e.printStackTrace();
        Logger.error(e.toString());
        return null;
    }
}

From source file:net.lacolaco.smileessence.twitter.task.DeleteMessageTask.java

License:Open Source License

@Override
protected DirectMessage doInBackground(Void... params) {
    try {//ww  w  .  ja  v  a  2s. c  om
        return twitter.directMessages().destroyDirectMessage(messageID);
    } catch (TwitterException e) {
        e.printStackTrace();
        Logger.error(e.toString());
        return null;
    }
}

From source file:net.lacolaco.smileessence.twitter.task.DeleteStatusTask.java

License:Open Source License

@Override
protected twitter4j.Status doInBackground(Void... params) {
    try {/* w ww  .ja  v a  2  s  .c  o m*/
        return twitter.tweets().destroyStatus(statusID);
    } catch (TwitterException e) {
        e.printStackTrace();
        Logger.error(e.toString());
        return null;
    }
}

From source file:net.lacolaco.smileessence.twitter.task.DirectMessagesTask.java

License:Open Source License

@Override
protected DirectMessage[] doInBackground(Void... params) {
    ResponseList<DirectMessage> responseList;
    try {/*from   w  w  w .j  av a  2s.  c  o  m*/
        if (paging == null) {
            responseList = twitter.directMessages().getDirectMessages();
        } else {
            responseList = twitter.directMessages().getDirectMessages(paging);
        }
    } catch (TwitterException e) {
        e.printStackTrace();
        Logger.error(e.toString());
        if (e.exceededRateLimitation()) {
            Notificator.publish(activity, R.string.notice_error_rate_limit, NotificationType.ALERT);
        } else {
            Notificator.publish(activity, R.string.notice_error_get_messages, NotificationType.ALERT);
        }
        return new DirectMessage[0];
    }
    return responseList.toArray(new DirectMessage[responseList.size()]);
}

From source file:net.lacolaco.smileessence.twitter.task.FavoriteTask.java

License:Open Source License

@Override
protected twitter4j.Status doInBackground(Void... params) {
    try {/*w  ww .j  a v a 2 s.  co  m*/
        return twitter.favorites().createFavorite(statusID);
    } catch (TwitterException e) {
        e.printStackTrace();
        Logger.error(e.toString());
        return null;
    }
}

From source file:net.lacolaco.smileessence.twitter.task.FollowTask.java

License:Open Source License

@Override
protected User doInBackground(Void... params) {
    try {/*from  w w w  .j  a  va2  s.c  om*/
        return twitter.friendsFollowers().createFriendship(userID);
    } catch (TwitterException e) {
        e.printStackTrace();
        Logger.error(e.toString());
        return null;
    }
}

From source file:net.lacolaco.smileessence.twitter.task.HomeTimelineTask.java

License:Open Source License

@Override
protected twitter4j.Status[] doInBackground(Void... params) {
    ResponseList<twitter4j.Status> responseList;
    try {//from   w w  w. jav a2s  .  c o m
        if (paging == null) {
            responseList = twitter.timelines().getHomeTimeline();
        } else {
            responseList = twitter.timelines().getHomeTimeline(paging);
        }
    } catch (TwitterException e) {
        e.printStackTrace();
        Logger.error(e.toString());
        if (e.exceededRateLimitation()) {
            Notificator.publish(activity, R.string.notice_error_rate_limit, NotificationType.ALERT);
        } else {
            Notificator.publish(activity, R.string.notice_error_get_home, NotificationType.ALERT);
        }
        return new twitter4j.Status[0];
    }
    return responseList.toArray(new twitter4j.Status[responseList.size()]);
}

From source file:net.lacolaco.smileessence.twitter.task.MentionsTimelineTask.java

License:Open Source License

@Override
protected twitter4j.Status[] doInBackground(Void... params) {
    ResponseList<twitter4j.Status> responseList;
    try {/*from   w  w  w. jav  a 2  s  . c  om*/
        if (paging == null) {
            responseList = twitter.timelines().getMentionsTimeline();
        } else {
            responseList = twitter.timelines().getMentionsTimeline(paging);
        }
    } catch (TwitterException e) {
        e.printStackTrace();
        Logger.error(e.toString());
        if (e.exceededRateLimitation()) {
            Notificator.publish(activity, R.string.notice_error_rate_limit, NotificationType.ALERT);
        } else {
            Notificator.publish(activity, R.string.notice_error_get_mentions, NotificationType.ALERT);
        }
        return new twitter4j.Status[0];
    }
    return responseList.toArray(new twitter4j.Status[responseList.size()]);
}

From source file:net.lacolaco.smileessence.twitter.task.ReportForSpamTask.java

License:Open Source License

@Override
protected User doInBackground(Void... params) {
    try {/*from   w w  w . ja  v a2 s.  c  o  m*/
        return twitter.spamReporting().reportSpam(userID);
    } catch (TwitterException e) {
        e.printStackTrace();
        Logger.error(e.toString());
        return null;
    }
}