OSDN Git Service

getFollowingUser関数のpageの値によってindexOutOfBoundsExceptionが発生する問題を解決 refs #23442
authorspark_xp <spark_xp@d8c9ecd3-d47d-4367-8645-de82c00e513f>
Sun, 15 May 2011 11:16:59 +0000 (11:16 +0000)
committerspark_xp <spark_xp@d8c9ecd3-d47d-4367-8645-de82c00e513f>
Sun, 15 May 2011 11:16:59 +0000 (11:16 +0000)
git-svn-id: http://svn.sourceforge.jp/svnroot/nt-manager/NishioTweetManager/trunk@139 d8c9ecd3-d47d-4367-8645-de82c00e513f

src/twitter/gui/action/TweetMainAction.java
src/twitter/manage/TweetManager.java

index 71a9e63..6adcda2 100644 (file)
@@ -1528,8 +1528,10 @@ public class TweetMainAction {
                //this.actionConvertTweetBoxURLToBitly();
                for(int i=0; i < 5; i++) {
                        List<User> lists = this.tweetManager.getFollowingUser("nishio_dens", i);
-                       for(User u : lists) {
-                               System.out.println( u );
+                       if( lists != null) {
+                               for(User u : lists) {
+                                       System.out.println( u );
+                               }
                        }
                }
 //             String url = "http://google.com";
index a390b2c..207dd46 100644 (file)
@@ -1233,7 +1233,15 @@ public class TweetManager {
                List<Long> getFollowingUserIds = null;
                List<Long> followingList = this.followingUserIDList.get(screenName);
                if( followingList != null && followingList.size() > 0 ) {
-                       getFollowingUserIds = followingList.subList(page * 100, page * 100 + 99);
+                       //データ存在しない
+                       if( followingList.size() < page * 100 ) {
+                               return null;
+                       }
+                       int to = page * 100 + 99;
+                       if( followingList.size() < to){
+                               to = to - (to - followingList.size());
+                       }
+                       getFollowingUserIds = followingList.subList(page * 100, to);
                }
                
                //結果