Changeset 15041

Show
Ignore:
Timestamp:
07/02/08 13:56:31 (5 years ago)
Author:
yamashiro
Message:

不正なid/passwordが設定されていると、固まるので、twitter4jのAsyncTwitterを使わないで独自実装を使うように修正した。

Location:
lang/java/sabotter/trunk/src/jp/xet/eclipse/sabotter/core/impl
Files:
1 added
2 modified

Legend:

Unmodified
Added
Removed
  • lang/java/sabotter/trunk/src/jp/xet/eclipse/sabotter/core/impl/SabotterImpl.java

    r14933 r15041  
    1111import org.eclipse.core.net.proxy.IProxyService; 
    1212 
    13 import twitter4j.AsyncTwitter; 
    1413import twitter4j.TwitterException; 
    1514 
     
    1817 *  
    1918 * @author Ewigkeit 
     19 *  
    2020 * @see twitter4j.AsyncTwitter 
    2121 */ 
     
    2424        private static final String TWITTER_SOURCE = "sabotter"; 
    2525         
    26         private AsyncTwitter twitter; 
     26        private SabotterAsyncTwitter twitter; 
    2727         
    2828 
     
    4848                } 
    4949                 
    50                 this.twitter = new AsyncTwitter(id, password); 
     50                this.twitter = new SabotterAsyncTwitter(id, password); 
     51                this.twitter.verifyCredentials(); 
    5152                this.twitter.setSource(TWITTER_SOURCE); 
    5253        } 
     
    6061         */ 
    6162        public SabotterImpl(String id, String password, String baseURL) { 
    62                 this.twitter = new AsyncTwitter(id, password, baseURL); 
    63                 this.twitter.forceUsePost(true); 
     63                // TODO 使っていない? this.twitter = new SabotterAsyncTwitter(id, password, baseURL); 
     64                // this.twitter.forceUsePost(true); 
    6465        } 
    6566         
     
    8081         */ 
    8182        public final void getFriendsTimelineAsync(SabotterListener listener) { 
     83                // this.twitter.verifyCredentials(); 
    8284                this.twitter.getFriendsTimelineAsync(new TwitterAdapterWrapper(listener)); 
    8385        } 
     
    107109        /** 
    108110         * Override method. 
     111         *  
    109112         * @see jp.xet.eclipse.sabotter.core.Sabotter#getRepliesAsync(jp.xet.eclipse.sabotter.core.SabotterListener) 
    110113         */ 
     
    115118        /** 
    116119         * Override method. 
     120         *  
    117121         * @see jp.xet.eclipse.sabotter.core.Sabotter#getDirectMessagesAsync(jp.xet.eclipse.sabotter.core.SabotterListener) 
    118122         */ 
     
    123127        /** 
    124128         * Override method. 
     129         *  
    125130         * @see jp.xet.eclipse.sabotter.core.Sabotter#changeAccount(java.lang.String, java.lang.String) 
    126131         */ 
  • lang/java/sabotter/trunk/src/jp/xet/eclipse/sabotter/core/impl/TwitterAdapterWrapper.java

    r12970 r15041  
    44import java.util.List; 
    55 
     6import jp.xet.eclipse.sabotter.SabotterPlugin; 
    67import jp.xet.eclipse.sabotter.core.SabotterEntry; 
    78import jp.xet.eclipse.sabotter.core.SabotterListener; 
     
    1718 *  
    1819 * @author Ewigkeit 
     20 *  
    1921 * @see twitter4j.TwitterAdapter 
    2022 */ 
     
    5153        /** 
    5254         * Override method. 
     55         *  
    5356         * @see twitter4j.TwitterAdapter#gotDirectMessages(java.util.List) 
    5457         */ 
     
    6669        /** 
    6770         * Override method. 
     71         *  
    6872         * @see twitter4j.TwitterAdapter#gotReplies(java.util.List) 
    6973         */ 
     
    8690        @Override 
    8791        public void onException(TwitterException ex, int method) { 
     92                if (ex.getStatusCode() == 400) { // タイムライン取得制限 
     93                        SabotterPlugin.handleException(ex, SabotterPlugin.DIALOG, "APIタイム制限です"); 
     94                } 
     95                ex.printStackTrace(); 
    8896                this.listener.onException(new SabotterException(ex), method); 
    8997        }