瀏覽代碼

Lots of twitter-related changes.

Revert the worst attempt at "style fixing" I have every seen in my life, and reapply some of the non-awful ones.
Fixes issue 0004205: twitter parser can't cope with trailing space left by the join command
Fixes issue 0004143: Command to force twitter parser to get new tweets
(/ctcp <channel> <refresh|update>)
Fixes issue 0004119: twitter parser renaming, leaves old client
Fixes issue 0003980: Kicking people with twitter parser should give some kind of feedback
(/KICK Command changed from raw to non-raw which broke this)
Fixes issue 0003932: twitter parser should auto-rejoin when parting &twitter
Fixes issue 0003809: Typo in twitter plugin prefs: prepend *nickanmes* with @
Fixes issue 0003761: Twitter now allows 350 api calls per hour (Soon 1500)
Fixes issue 0003760: Option to auto-part &channels on twitter after status has been set

Change FreeDesktop Notifications plugin to use a new thread rather than blocking.

Change-Id: I4df6553024608074b2f1ab8eec99f13f7da2ad3a
Reviewed-on: http://gerrit.dmdirc.com/1338
Reviewed-by: Gregory Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
tags/0.6.4
Shane Mc Cormack 14 年之前
父節點
當前提交
534bed2d20
共有 22 個文件被更改,包括 812 次插入953 次删除
  1. 8
    3
      src/com/dmdirc/addons/freedesktop_notifications/FDNotifyCommand.java
  2. 5
    1
      src/com/dmdirc/addons/parser_twitter/Debug.java
  3. 482
    737
      src/com/dmdirc/addons/parser_twitter/Twitter.java
  4. 3
    4
      src/com/dmdirc/addons/parser_twitter/TwitterCallbackManager.java
  5. 1
    2
      src/com/dmdirc/addons/parser_twitter/TwitterCallbackObject.java
  6. 1
    2
      src/com/dmdirc/addons/parser_twitter/TwitterCallbackObjectSpecific.java
  7. 12
    3
      src/com/dmdirc/addons/parser_twitter/TwitterChannelClientInfo.java
  8. 24
    11
      src/com/dmdirc/addons/parser_twitter/TwitterChannelInfo.java
  9. 73
    23
      src/com/dmdirc/addons/parser_twitter/TwitterClientInfo.java
  10. 12
    12
      src/com/dmdirc/addons/parser_twitter/TwitterPlugin.java
  11. 2
    0
      src/com/dmdirc/addons/parser_twitter/api/APIAllowed.java
  12. 124
    106
      src/com/dmdirc/addons/parser_twitter/api/TwitterAPI.java
  13. 3
    1
      src/com/dmdirc/addons/parser_twitter/api/TwitterErrorHandler.java
  14. 7
    3
      src/com/dmdirc/addons/parser_twitter/api/TwitterMessage.java
  15. 4
    2
      src/com/dmdirc/addons/parser_twitter/api/TwitterRawHandler.java
  16. 6
    3
      src/com/dmdirc/addons/parser_twitter/api/TwitterStatus.java
  17. 7
    6
      src/com/dmdirc/addons/parser_twitter/api/TwitterUser.java
  18. 5
    3
      src/com/dmdirc/addons/parser_twitter/api/XMLResponse.java
  19. 14
    13
      src/com/dmdirc/addons/parser_twitter/api/commons/Entities.java
  20. 9
    9
      src/com/dmdirc/addons/parser_twitter/api/commons/IntHashMap.java
  21. 6
    6
      src/com/dmdirc/addons/parser_twitter/api/commons/StringEscapeUtils.java
  22. 4
    3
      src/com/dmdirc/addons/parser_twitter/plugin.config

+ 8
- 3
src/com/dmdirc/addons/freedesktop_notifications/FDNotifyCommand.java 查看文件

@@ -53,9 +53,14 @@ public final class FDNotifyCommand extends Command implements CommandInfo {
53 53
 
54 54
     /** {@inheritDoc} */
55 55
     @Override
56
-    public void execute(final FrameContainer<?> origin,
57
-            final CommandArguments args, final CommandContext context) {
58
-        myPlugin.showNotification("", args.getArgumentsAsString());
56
+    public void execute(final FrameContainer<?> origin, final CommandArguments args, final CommandContext context) {
57
+        new Thread() {
58
+            /** {@inheritDoc} */
59
+            @Override
60
+            public void run() {
61
+                myPlugin.showNotification("", args.getArgumentsAsString());
62
+            }
63
+        }.start();
59 64
     }
60 65
     
61 66
     

+ 5
- 1
src/com/dmdirc/addons/parser_twitter/Debug.java 查看文件

@@ -28,6 +28,7 @@ package com.dmdirc.addons.parser_twitter;
28 28
  * @author shane
29 29
  */
30 30
 enum Debug {
31
+
31 32
     /** Debug information related to api calls. */
32 33
     apiCalls,
33 34
     /** Debug information related to sleeping. */
@@ -41,5 +42,8 @@ enum Debug {
41 42
     /** General error info from the twitter parser. */
42 43
     twitterError,
43 44
     /** More debuggy error info from the twitter parser. */
44
-    twitterErrorMore;
45
+    twitterErrorMore,
46
+    /** General debuggy stuff. */
47
+    twitterGeneralDebug;
48
+
45 49
 }

+ 482
- 737
src/com/dmdirc/addons/parser_twitter/Twitter.java
文件差異過大導致無法顯示
查看文件


+ 3
- 4
src/com/dmdirc/addons/parser_twitter/TwitterCallbackManager.java 查看文件

@@ -33,6 +33,7 @@ import com.dmdirc.parser.interfaces.callbacks.CallbackInterface;
33 33
  * @author chris
34 34
  */
35 35
 public class TwitterCallbackManager extends CallbackManager<Twitter> {
36
+
36 37
     /**
37 38
      * Create a new TwitterCallbackManager
38 39
      * 
@@ -50,10 +51,8 @@ public class TwitterCallbackManager extends CallbackManager<Twitter> {
50 51
 
51 52
     /** {@inheritDoc} */
52 53
     @Override
53
-    protected CallbackObjectSpecific getSpecificCallbackObject(final Twitter parser,
54
-            final Class<?> type) {
55
-        return new TwitterCallbackObjectSpecific(parser, this,
56
-                type.asSubclass(CallbackInterface.class));
54
+    protected CallbackObjectSpecific getSpecificCallbackObject(final Twitter parser, final Class<?> type) {
55
+        return new TwitterCallbackObjectSpecific(parser, this, type.asSubclass(CallbackInterface.class));
57 56
     }
58 57
 
59 58
 }

+ 1
- 2
src/com/dmdirc/addons/parser_twitter/TwitterCallbackObject.java 查看文件

@@ -58,8 +58,7 @@ public class TwitterCallbackObject extends CallbackObject {
58 58
      * @param manager Callback Manager that owns this object.
59 59
      * @param type Type of callback.
60 60
      */
61
-    public TwitterCallbackObject(final Parser parser, final CallbackManager<?> manager,
62
-            final Class<? extends CallbackInterface> type) {
61
+    public TwitterCallbackObject(final Parser parser, final CallbackManager<?> manager, final Class<? extends CallbackInterface> type) {
63 62
         super(parser, manager, type);
64 63
     }
65 64
 

+ 1
- 2
src/com/dmdirc/addons/parser_twitter/TwitterCallbackObjectSpecific.java 查看文件

@@ -59,8 +59,7 @@ public class TwitterCallbackObjectSpecific extends CallbackObjectSpecific {
59 59
      * @param manager Callback Manager that owns this object.
60 60
      * @param type Type of callback.
61 61
      */
62
-    public TwitterCallbackObjectSpecific(final Parser parser,
63
-            final CallbackManager<?> manager, final Class<? extends CallbackInterface> type) {
62
+    public TwitterCallbackObjectSpecific(final Parser parser, final CallbackManager<?> manager, final Class<? extends CallbackInterface> type) {
64 63
         super(parser, manager, type);
65 64
     }
66 65
 

+ 12
- 3
src/com/dmdirc/addons/parser_twitter/TwitterChannelClientInfo.java 查看文件

@@ -25,6 +25,7 @@ package com.dmdirc.addons.parser_twitter;
25 25
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
26 26
 import com.dmdirc.parser.interfaces.ChannelInfo;
27 27
 import com.dmdirc.parser.interfaces.ClientInfo;
28
+import com.dmdirc.parser.interfaces.callbacks.ChannelKickListener;
28 29
 
29 30
 import java.util.HashMap;
30 31
 import java.util.Map;
@@ -35,9 +36,10 @@ import java.util.Map;
35 36
  * @author shane
36 37
  */
37 38
 public class TwitterChannelClientInfo implements ChannelClientInfo {
39
+
38 40
     /** My ChannelInfo.  */
39 41
     private TwitterChannelInfo myChannel;
40
-    
42
+
41 43
     /** My ClientInfo. */
42 44
     private TwitterClientInfo myClient;
43 45
 
@@ -102,9 +104,11 @@ public class TwitterChannelClientInfo implements ChannelClientInfo {
102 104
      * @return Value for this clients modes.
103 105
      */
104 106
     public int getImportantModeValue() {
105
-        if (myClient == null || myClient.isFake()) { return 0; }
107
+        if (myClient == null || myClient.isFake()) {
108
+            return 0;
109
+        }
106 110
         final String ourNickname = ((Twitter) myClient.getParser()).getApi().getDisplayUsername();
107
-        
111
+
108 112
         if (ourNickname.equalsIgnoreCase(myClient.getNickname())) {
109 113
             // Show ourselves as half-op
110 114
             return 2;
@@ -132,6 +136,10 @@ public class TwitterChannelClientInfo implements ChannelClientInfo {
132 136
     /** {@inheritDoc} */
133 137
     @Override
134 138
     public void kick(final String message) {
139
+        final Twitter parser = (Twitter) myChannel.getParser();
140
+        final ClientInfo ci = parser.getLocalClient();
141
+        parser.getCallbackManager().getCallbackType(ChannelKickListener.class).call(myChannel, this, myChannel.getChannelClient(ci), message, ci.getHostname());
142
+
135 143
         ((Twitter) myClient.getParser()).getApi().delFriend(myClient.getUser().getScreenName());
136 144
         myChannel.delChannelClient(this);
137 145
         myClient.delChannelClient(this);
@@ -162,4 +170,5 @@ public class TwitterChannelClientInfo implements ChannelClientInfo {
162 170
     public String toString() {
163 171
         return getImportantModePrefix() + myClient.getNickname();
164 172
     }
173
+
165 174
 }

+ 24
- 11
src/com/dmdirc/addons/parser_twitter/TwitterChannelInfo.java 查看文件

@@ -39,12 +39,13 @@ import java.util.Map;
39 39
  * @author shane
40 40
  */
41 41
 public class TwitterChannelInfo implements ChannelInfo {
42
+
42 43
     /** Name of this channel. */
43 44
     private final String myName;
44 45
 
45 46
     /** The Parser that owns this object. */
46 47
     private final Twitter myParser;
47
-    
48
+
48 49
     /** Topic of this channel. */
49 50
     private String myTopic = "";
50 51
 
@@ -60,6 +61,9 @@ public class TwitterChannelInfo implements ChannelInfo {
60 61
     /** Map to store misc stuff in. */
61 62
     private Map<Object, Object> myMap = new HashMap<Object, Object>();
62 63
 
64
+    /** Known blocked users. */
65
+    private Collection<ChannelListModeItem> bannedList = new ArrayList<ChannelListModeItem>();
66
+
63 67
     /**
64 68
      * Create a new TwitterChannelInfo.
65 69
      *
@@ -233,23 +237,31 @@ public class TwitterChannelInfo implements ChannelInfo {
233 237
     /** {@inheritDoc} */
234 238
     @Override
235 239
     public void requestListModes() {
236
-        throw new UnsupportedOperationException("Not supported yet.");
240
+        new Thread() {
241
+
242
+            /** {@inheritDoc} */
243
+            @Override
244
+            public void run() {
245
+                final ArrayList<ChannelListModeItem> items = new ArrayList<ChannelListModeItem>();
246
+
247
+                final long time = System.currentTimeMillis() / 1000;
248
+                for (final TwitterUser user : myParser.getApi().getBlocked()) {
249
+                    items.add(new ChannelListModeItem(user.getScreenName(), myParser.getApi().getDisplayUsername(), time));
250
+                }
251
+                bannedList = items;
252
+            }
253
+
254
+        }.start();
237 255
     }
238 256
 
239 257
     /** {@inheritDoc} */
240 258
     @Override
241 259
     public Collection<ChannelListModeItem> getListMode(final char mode) {
242
-        final ArrayList<ChannelListModeItem> items = new ArrayList<ChannelListModeItem>();
243
-
244
-        // Ideally this should be cached somewhere, but for now this will do.
245 260
         if (mode == 'b') {
246
-            final long time = System.currentTimeMillis() / 1000;
247
-            for (TwitterUser user : myParser.getApi().getBlocked()) {
248
-                items.add(new ChannelListModeItem(user.getScreenName(), myParser.getApi().getDisplayUsername(), time));
249
-            }
261
+            return bannedList;
262
+        } else {
263
+            return new ArrayList<ChannelListModeItem>();
250 264
         }
251
-
252
-        return items;
253 265
     }
254 266
 
255 267
     /**
@@ -284,4 +296,5 @@ public class TwitterChannelInfo implements ChannelInfo {
284 296
     public Map<Object, Object> getMap() {
285 297
         return myMap;
286 298
     }
299
+
287 300
 }

+ 73
- 23
src/com/dmdirc/addons/parser_twitter/TwitterClientInfo.java 查看文件

@@ -27,7 +27,6 @@ import com.dmdirc.parser.interfaces.ChannelClientInfo;
27 27
 import com.dmdirc.parser.interfaces.LocalClientInfo;
28 28
 import com.dmdirc.parser.interfaces.Parser;
29 29
 import com.dmdirc.plugins.Plugin;
30
-
31 30
 import java.util.ArrayList;
32 31
 import java.util.HashMap;
33 32
 import java.util.List;
@@ -39,9 +38,13 @@ import java.util.Map;
39 38
  * @author shane
40 39
  */
41 40
 public class TwitterClientInfo implements LocalClientInfo {
41
+
42 42
     /** This Clients User */
43 43
     private String myUser;
44 44
 
45
+    /** This Clients User Id. */
46
+    private long myUserId;
47
+
45 48
     /** My Parser */
46 49
     private Twitter myParser;
47 50
 
@@ -82,11 +85,21 @@ public class TwitterClientInfo implements LocalClientInfo {
82 85
 
83 86
         String[] temp = null;
84 87
         final String[] result = new String[3];
85
-        if (!hostname.isEmpty() && hostname.charAt(0) == ':') { hostname = hostname.substring(1); }
88
+        if (!hostname.isEmpty() && hostname.charAt(0) == ':') {
89
+            hostname = hostname.substring(1);
90
+        }
86 91
         temp = hostname.split("@", 2);
87
-        if (temp.length == 1) { result[2] = ""; } else { result[2] = temp[1]; }
92
+        if (temp.length == 1) {
93
+            result[2] = "";
94
+        } else {
95
+            result[2] = temp[1];
96
+        }
88 97
         temp = temp[0].split("!", 2);
89
-        if (temp.length == 1) { result[1] = ""; } else { result[1] = temp[1]; }
98
+        if (temp.length == 1) {
99
+            result[1] = "";
100
+        } else {
101
+            result[1] = temp[1];
102
+        }
90 103
         result[0] = (hadAt ? "@" : "") + temp[0];
91 104
 
92 105
         return result;
@@ -109,8 +122,32 @@ public class TwitterClientInfo implements LocalClientInfo {
109 122
      * @param parser Parser that owns this client.
110 123
      */
111 124
     public TwitterClientInfo(final String user, final Twitter parser) {
112
-        this.myUser = user;
113 125
         this.myParser = parser;
126
+        setUser(user);
127
+    }
128
+
129
+    /**
130
+     * Set the user for this TwitterClientInfo
131
+     *
132
+     * @param user Name of user.
133
+     */
134
+    public void setUser(final String user) {
135
+        this.myUser = user;
136
+        final TwitterUser tu = myParser.getApi().getCachedUser(myUser);
137
+        this.myUserId = tu == null ? -1 : tu.getID();
138
+    }
139
+
140
+    /**
141
+     * Set the user for this TwitterClientInfo.
142
+     *
143
+     * @param user User object
144
+     */
145
+    public void setUser(final TwitterUser user) {
146
+        if (user == null) {
147
+            return;
148
+        }
149
+        this.myUser = user.getScreenName();
150
+        this.myUserId = user.getID();
114 151
     }
115 152
 
116 153
     /** {@inheritDoc} */
@@ -133,26 +170,39 @@ public class TwitterClientInfo implements LocalClientInfo {
133 170
     }
134 171
 
135 172
     /**
136
-    * Check if this is a fake client.
137
-    *
138
-    * @return True if this is a fake client, else false
139
-    */
140
-    public boolean isFake() { return isFake; }
141
-    
173
+     * Get the user ID this client.
174
+     *
175
+     * @return User ID for this client.
176
+     */
177
+    public long getUserID() {
178
+        return myUserId;
179
+    }
180
+
181
+    /**
182
+     * Check if this is a fake client.
183
+     *
184
+     * @return True if this is a fake client, else false
185
+     */
186
+    public boolean isFake() {
187
+        return isFake;
188
+    }
189
+
142 190
     /**
143
-    * Check if this client is actually a server.
144
-    *
145
-    * @return True if this client is actually a server.
146
-    */
147
-    public boolean isServer() { return !(myUser.indexOf(':') == -1); }
148
-    
191
+     * Check if this client is actually a server.
192
+     *
193
+     * @return True if this client is actually a server.
194
+     */
195
+    public boolean isServer() {
196
+        return !(myUser.indexOf(':') == -1);
197
+    }
198
+
149 199
     /**
150
-    * Set if this is a fake client.
151
-    * This returns "this" and thus can be used in the construction line.
152
-    *
153
-    * @param newValue new value for isFake - True if this is a fake client, else false
154
-    * @return this Object
155
-    */
200
+     * Set if this is a fake client.
201
+     * This returns "this" and thus can be used in the construction line.
202
+     *
203
+     * @param newValue new value for isFake - True if this is a fake client, else false
204
+     * @return this Object
205
+     */
156 206
     public TwitterClientInfo setFake(final boolean newValue) {
157 207
         isFake = newValue;
158 208
         return this;

+ 12
- 12
src/com/dmdirc/addons/parser_twitter/TwitterPlugin.java 查看文件

@@ -40,14 +40,16 @@ import java.util.ArrayList;
40 40
  *
41 41
  * @author shane
42 42
  */
43
-public class TwitterPlugin extends Plugin  {
43
+public class TwitterPlugin extends Plugin {
44
+
44 45
     /** Are we currently unloading? */
45 46
     private static boolean unloading = false;
46 47
 
47 48
     /**
48 49
      * Create a TwitterPlugin
49 50
      */
50
-    public TwitterPlugin() { }
51
+    public TwitterPlugin() {
52
+    }
51 53
 
52 54
     /** {@inheritDoc} */
53 55
     @Override
@@ -59,7 +61,7 @@ public class TwitterPlugin extends Plugin  {
59 61
     @Override
60 62
     public void onUnload() {
61 63
         unloading = true;
62
-        for (Twitter parser : new ArrayList<Twitter>(Twitter.PARSERS)) {
64
+        for (final Twitter parser : new ArrayList<Twitter>(Twitter.currentParsers)) {
63 65
             parser.disconnect("");
64 66
         }
65 67
     }
@@ -88,25 +90,23 @@ public class TwitterPlugin extends Plugin  {
88 90
     /** {@inheritDoc} */
89 91
     @Override
90 92
     public void showConfig(final PreferencesManager manager) {
91
-        final PreferencesCategory category = new PluginPreferencesCategory(
92
-                getPluginInfo(), "Twitter Plugin", "Settings related to the twitter plugin",
93
-                "category-twitter");
94
-        final PreferencesCategory advanced = new PluginPreferencesCategory(
95
-                getPluginInfo(), "Advanced", "Advanced Settings related to the twitter plugin",
96
-                "category-twitter");
93
+        final PreferencesCategory category = new PluginPreferencesCategory(getPluginInfo(), "Twitter Plugin", "Settings related to the twitter plugin", "category-twitter");
94
+        final PreferencesCategory advanced = new PluginPreferencesCategory(getPluginInfo(), "Advanced", "Advanced Settings related to the twitter plugin", "category-twitter");
97 95
 
98 96
         category.addSetting(new PreferencesSetting(PreferencesType.INTEGER, getDomain(), "statuscount", "Statuses to request", "How many statuses to request at a time?"));
99
-        category.addSetting(new PreferencesSetting(PreferencesType.INTEGER, getDomain(), "apicalls", "API Calls", "Aim to only use how many API Calls per hour? (Twitter has a max of 150)"));
97
+        category.addSetting(new PreferencesSetting(PreferencesType.INTEGER, getDomain(), "apicalls", "API Calls", "Aim to only use how many API Calls per hour? (Twitter has a max of 350)"));
100 98
         category.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN, getDomain(), "saveLastIDs", "Remember shown items", "Should previously shown items not be shown again next time?"));
101 99
         category.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN, getDomain(), "getSentMessages", "Show own Direct Messages", "Should we try to show our own direct messages to people not just ones to us?"));
102 100
 
103
-        advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN, getDomain(), "autoAt", "Prepend nickanmes with @", "Should all nicknmaes be shown with an @ infront of them? (Makes tab competion easier)"));
101
+        advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN, getDomain(), "autoAt", "Prepend nicknames with @", "Should all nicknmaes be shown with an @ infront of them? (Makes tab competion easier)"));
104 102
         advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN, getDomain(), "replaceOpeningNickname", "Replace opening nickame?", "Should nicknames at the start of the message be replaced? (eg Replace foo: with @foo)"));
105 103
         advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN, getDomain(), "debugEnabled", "Debugging Enabled?", "Should more debugging be enabled on the twitter plugin?"));
106 104
         advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN, getDomain(), "hide500Errors", "Hide HTTP 50x Errors", "At times twitter gives a lot of 502/503 errors. Should this be hidden from you?"));
105
+        advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN, getDomain(), "autoLeaveMessageChannel", "Leave & channels automatically?", "Should you automatically be parted from & channels after sending a message?"));
107 106
 
108 107
         category.addSubCategory(advanced);
109 108
 
110 109
         manager.getCategory("Plugins").addSubCategory(category);
111 110
     }
112
-}
111
+
112
+}

+ 2
- 0
src/com/dmdirc/addons/parser_twitter/api/APIAllowed.java 查看文件

@@ -27,6 +27,7 @@ package com.dmdirc.addons.parser_twitter.api;
27 27
  * @author shane
28 28
  */
29 29
 public enum APIAllowed {
30
+
30 31
     /** It is not known if we are allowed or not. */
31 32
     UNKNOWN(false),
32 33
     /** We are not allowed. */
@@ -54,4 +55,5 @@ public enum APIAllowed {
54 55
     public boolean getBooleanValue() {
55 56
         return value;
56 57
     }
58
+
57 59
 }

+ 124
- 106
src/com/dmdirc/addons/parser_twitter/api/TwitterAPI.java 查看文件

@@ -61,13 +61,13 @@ import org.w3c.dom.Element;
61 61
 import org.w3c.dom.NodeList;
62 62
 import org.xml.sax.SAXException;
63 63
 
64
-
65 64
 /**
66 65
  * Implementation of the twitter API for DMDirc.
67 66
  * 
68 67
  * @author shane
69 68
  */
70 69
 public class TwitterAPI {
70
+
71 71
     /** OAuth Consumer */
72 72
     private OAuthConsumer consumer;
73 73
 
@@ -100,10 +100,10 @@ public class TwitterAPI {
100 100
 
101 101
     /** API Allowed status */
102 102
     private APIAllowed allowed = APIAllowed.UNKNOWN;
103
-    
103
+
104 104
     /** How many API calls have we made since the last reset? */
105 105
     private int usedCalls = 0;
106
-    
106
+
107 107
     /** API reset time. */
108 108
     private long resetTime = 0;
109 109
 
@@ -133,7 +133,7 @@ public class TwitterAPI {
133 133
 
134 134
     /** Should we use ssl? */
135 135
     private boolean useSSL = false;
136
-    
136
+
137 137
     /** Should we enable debug? */
138 138
     private boolean debug = false;
139 139
 
@@ -190,20 +190,22 @@ public class TwitterAPI {
190 190
         this.autoAt = autoAt;
191 191
         this.myDisplayUsername = (autoAt ? "@" : "") + myLoginUsername;
192 192
 
193
-        if (this.apiAddress.isEmpty() && myLoginUsername.isEmpty()) { return; }
193
+        if (this.apiAddress.isEmpty() && myLoginUsername.isEmpty()) {
194
+            return;
195
+        }
194 196
 
195 197
         if (!consumerKey.isEmpty() && !consumerSecret.isEmpty()) {
196 198
             consumer = new DefaultOAuthConsumer(consumerKey, consumerSecret, SignatureMethod.HMAC_SHA1);
197 199
             final String thisOauthAddress = ((useSSL) ? "https" : "http") + "://" + ((oauthAddress == null || oauthAddress.isEmpty()) ? apiAddress.replaceAll("/+$", "") + "/oauth" : oauthAddress.replaceAll("/+$", ""));
198
-            
199
-            provider = new DefaultOAuthProvider(consumer, thisOauthAddress+"/request_token", thisOauthAddress+"/access_token", thisOauthAddress+"/authorize");
200
+
201
+            provider = new DefaultOAuthProvider(consumer, thisOauthAddress + "/request_token", thisOauthAddress + "/access_token", thisOauthAddress + "/authorize");
200 202
 
201 203
             this.token = token;
202 204
             this.tokenSecret = tokenSecret;
203 205
 
204 206
             try {
205 207
                 useOAuth = !(getOAuthURL().isEmpty());
206
-            } catch (TwitterRuntimeException tre) {
208
+            } catch (final TwitterRuntimeException tre) {
207 209
                 useOAuth = false;
208 210
             }
209 211
         } else {
@@ -278,7 +280,7 @@ public class TwitterAPI {
278 280
             errorHandlers.add(handler);
279 281
         }
280 282
     }
281
-    
283
+
282 284
     /**
283 285
      * Remove an error handler.
284 286
      *
@@ -289,7 +291,7 @@ public class TwitterAPI {
289 291
             errorHandlers.remove(handler);
290 292
         }
291 293
     }
292
-    
294
+
293 295
     /**
294 296
      * Clear error handlers.
295 297
      */
@@ -322,7 +324,7 @@ public class TwitterAPI {
322 324
      */
323 325
     private void handleError(final Throwable t, final String source, final String twitterInput, final String twitterOutput, final String message) {
324 326
         synchronized (errorHandlers) {
325
-            for (TwitterErrorHandler eh : errorHandlers) {
327
+            for (final TwitterErrorHandler eh : errorHandlers) {
326 328
                 eh.handleTwitterError(this, t, source, twitterInput, twitterOutput, message);
327 329
             }
328 330
         }
@@ -366,7 +368,7 @@ public class TwitterAPI {
366 368
      */
367 369
     private void handleRawInput(final String raw) {
368 370
         synchronized (rawHandlers) {
369
-            for (TwitterRawHandler rh : rawHandlers) {
371
+            for (final TwitterRawHandler rh : rawHandlers) {
370 372
                 rh.handleRawTwitterInput(this, raw);
371 373
             }
372 374
         }
@@ -379,7 +381,7 @@ public class TwitterAPI {
379 381
      */
380 382
     private void handleRawOutput(final String raw) {
381 383
         synchronized (rawHandlers) {
382
-            for (TwitterRawHandler rh : rawHandlers) {
384
+            for (final TwitterRawHandler rh : rawHandlers) {
383 385
                 rh.handleRawTwitterOutput(this, raw);
384 386
             }
385 387
         }
@@ -400,9 +402,8 @@ public class TwitterAPI {
400 402
      * @param autoAt Should we use autoAt?
401 403
      */
402 404
     /* public void setAutoAt(final boolean autoAt) {
403
-        this.autoAt = autoAt;
405
+    this.autoAt = autoAt;
404 406
     } */
405
-
406 407
     /**
407 408
      * Is debugging enabled?
408 409
      *
@@ -539,18 +540,18 @@ public class TwitterAPI {
539 540
             }
540 541
             try {
541 542
                 consumer.sign(connection);
542
-            } catch (OAuthMessageSignerException ex) {
543
+            } catch (final OAuthMessageSignerException ex) {
543 544
                 handleError(ex, "(1) signURL", apiInput, apiOutput, "Unable to sign URL, are we authorised to use this account?");
544
-            } catch (OAuthExpectationFailedException ex) {
545
+            } catch (final OAuthExpectationFailedException ex) {
545 546
                 handleError(ex, "(2) signURL", apiInput, apiOutput, "Unable to sign URL, are we authorised to use this account?");
546 547
             }
547 548
         } else {
548
-          // final String userpassword = myUsername + ":" + myPassword;
549
-          // sun.misc.BASE64Encoder enc = new sun.misc.BASE64Encoder();
550
-          // String encodedAuthorization = enc.encode(userpassword.getBytes());
549
+            // final String userpassword = myUsername + ":" + myPassword;
550
+            // sun.misc.BASE64Encoder enc = new sun.misc.BASE64Encoder();
551
+            // String encodedAuthorization = enc.encode(userpassword.getBytes());
551 552
 
552
-          final String encodedAuthorization = b64encode(myLoginUsername + ":" + myPassword);
553
-          connection.setRequestProperty("Authorization", "Basic "+ encodedAuthorization);
553
+            final String encodedAuthorization = b64encode(myLoginUsername + ":" + myPassword);
554
+            connection.setRequestProperty("Authorization", "Basic " + encodedAuthorization);
554 555
         }
555 556
     }
556 557
 
@@ -567,7 +568,7 @@ public class TwitterAPI {
567 568
         byte[] stringArray;
568 569
         try {
569 570
             stringArray = string.getBytes("UTF-8");
570
-        } catch (UnsupportedEncodingException ex) {
571
+        } catch (final UnsupportedEncodingException ex) {
571 572
             stringArray = string.getBytes();
572 573
         }
573 574
 
@@ -602,7 +603,7 @@ public class TwitterAPI {
602 603
     public static Long parseLong(final String string, final long fallback) {
603 604
         try {
604 605
             return Long.parseLong(string);
605
-        } catch (NumberFormatException nfe) {
606
+        } catch (final NumberFormatException nfe) {
606 607
             return fallback;
607 608
         }
608 609
     }
@@ -618,7 +619,7 @@ public class TwitterAPI {
618 619
     public static Long timeStringToLong(final String string, final long fallback) {
619 620
         try {
620 621
             return (new SimpleDateFormat("EEE MMM dd HH:mm:ss zzzz yyyy").parse(string)).getTime();
621
-        } catch (ParseException ex) {
622
+        } catch (final ParseException ex) {
622 623
             return fallback;
623 624
         }
624 625
     }
@@ -662,13 +663,13 @@ public class TwitterAPI {
662 663
         try {
663 664
             final URL url = new URL(address);
664 665
             return getXML((HttpURLConnection) url.openConnection());
665
-        } catch (MalformedURLException ex) {
666
+        } catch (final MalformedURLException ex) {
666 667
             if (isDebug()) {
667
-                handleError(ex, "* (1) getXML: "+address, apiInput, apiOutput);
668
+                handleError(ex, "* (1) getXML: " + address, apiInput, apiOutput);
668 669
             }
669
-        } catch (IOException ex) {
670
+        } catch (final IOException ex) {
670 671
             if (isDebug()) {
671
-                handleError(ex, "* (2) getXML: "+address, apiInput, apiOutput);
672
+                handleError(ex, "* (2) getXML: " + address, apiInput, apiOutput);
672 673
             }
673 674
         }
674 675
 
@@ -696,13 +697,13 @@ public class TwitterAPI {
696 697
         try {
697 698
             final URL url = new URL(address + (params.isEmpty() ? "" : "?" + params));
698 699
             return postXML((HttpURLConnection) url.openConnection());
699
-        } catch (MalformedURLException ex) {
700
+        } catch (final MalformedURLException ex) {
700 701
             if (isDebug()) {
701
-                handleError(ex, "* (1) postXML: "+address+" | "+params, apiInput, apiOutput);
702
+                handleError(ex, "* (1) postXML: " + address + " | " + params, apiInput, apiOutput);
702 703
             }
703
-        } catch (IOException ex) {
704
+        } catch (final IOException ex) {
704 705
             if (isDebug()) {
705
-                handleError(ex, "* (2) postXML: "+address+" | "+params, apiInput, apiOutput);
706
+                handleError(ex, "* (2) postXML: " + address + " | " + params, apiInput, apiOutput);
706 707
             }
707 708
         }
708 709
 
@@ -721,9 +722,9 @@ public class TwitterAPI {
721 722
             request.setRequestMethod("POST");
722 723
             request.setRequestProperty("Content-Length", "0");
723 724
             request.setUseCaches(false);
724
-        } catch (ProtocolException ex) {
725
+        } catch (final ProtocolException ex) {
725 726
             if (isDebug()) {
726
-                handleError(ex, "* (3) postXML: "+request.getURL(), apiInput, apiOutput);
727
+                handleError(ex, "* (3) postXML: " + request.getURL(), apiInput, apiOutput);
727 728
             }
728 729
         }
729 730
         return getXML(request);
@@ -750,11 +751,11 @@ public class TwitterAPI {
750 751
             signURL(request);
751 752
             request.connect();
752 753
             return true;
753
-        } catch (MalformedURLException ex) {
754
+        } catch (final MalformedURLException ex) {
754 755
             return false;
755
-        } catch (NoRouteToHostException ex) {
756
+        } catch (final NoRouteToHostException ex) {
756 757
             return false;
757
-        } catch (IOException ex) {
758
+        } catch (final IOException ex) {
758 759
             if (isDebug()) {
759 760
                 handleError(ex, "* (1) checkConnection", "", "");
760 761
             }
@@ -777,7 +778,7 @@ public class TwitterAPI {
777 778
             resetTime = System.currentTimeMillis() + 3600000;
778 779
         }
779 780
         usedCalls++;
780
-        
781
+
781 782
         apiInput = request.getURL().toString();
782 783
         handleRawOutput(apiInput);
783 784
         BufferedReader in = null;
@@ -788,9 +789,9 @@ public class TwitterAPI {
788 789
             request.setReadTimeout(5000);
789 790
             request.connect();
790 791
             in = new BufferedReader(new InputStreamReader(request.getInputStream()));
791
-        } catch (IOException ex) {
792
+        } catch (final IOException ex) {
792 793
             if (isDebug()) {
793
-                handleError(ex, "* (4) getXML: "+request.getURL(), apiInput, apiOutput);
794
+                handleError(ex, "* (4) getXML: " + request.getURL(), apiInput, apiOutput);
794 795
             }
795 796
             if (request.getErrorStream() != null) {
796 797
                 in = new BufferedReader(new InputStreamReader(request.getErrorStream()));
@@ -814,14 +815,17 @@ public class TwitterAPI {
814 815
                 } while (line != null);
815 816
 
816 817
                 apiOutput = xml.toString().trim();
817
-            } catch (IOException ex) {
818
+            } catch (final IOException ex) {
818 819
                 apiOutput = xml.toString().trim() + "\n ... Incomplete!";
819 820
                 incomplete = true;
820 821
                 if (isDebug()) {
821 822
                     handleError(ex, "* (5) getXML", apiInput, apiOutput);
822 823
                 }
823 824
             } finally {
824
-                try { in.close(); } catch (IOException ex) { }
825
+                try {
826
+                    in.close();
827
+                } catch (final IOException ex) {
828
+                }
825 829
             }
826 830
         }
827 831
 
@@ -833,12 +837,12 @@ public class TwitterAPI {
833 837
             responseCode = request.getResponseCode();
834 838
             if (responseCode != 200) {
835 839
                 if (isDebug()) {
836
-                    handleError(null, "* (6) getXML", apiInput, apiOutput, "("+request.getResponseCode()+") "+request.getResponseMessage());
840
+                    handleError(null, "* (6) getXML", apiInput, apiOutput, "(" + request.getResponseCode() + ") " + request.getResponseMessage());
837 841
                 } else if (responseCode >= 500 && responseCode < 600) {
838
-                    handleError(null, "(6) getXML", apiInput, apiOutput, "("+request.getResponseCode()+") "+request.getResponseMessage());
842
+                    handleError(null, "(6) getXML", apiInput, apiOutput, "(" + request.getResponseCode() + ") " + request.getResponseMessage());
839 843
                 }
840 844
             }
841
-        } catch (IOException ioe) {
845
+        } catch (final IOException ioe) {
842 846
             responseCode = 0;
843 847
             if (isDebug()) {
844 848
                 handleError(ioe, "* (7) getXML", apiInput, apiOutput, "Unable to get response code.");
@@ -847,7 +851,7 @@ public class TwitterAPI {
847 851
 
848 852
         try {
849 853
             final DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
850
-            
854
+
851 855
             final Document doc = db.parse(new ByteArrayInputStream(apiOutput.getBytes()));
852 856
 
853 857
             final XMLResponse response = new XMLResponse(request, doc);
@@ -856,15 +860,15 @@ public class TwitterAPI {
856 860
             }
857 861
 
858 862
             return response;
859
-        } catch (SAXException ex) {
863
+        } catch (final SAXException ex) {
860 864
             if (isDebug()) {
861 865
                 handleError(ex, "* (9) getXML", apiInput, apiOutput);
862 866
             }
863
-        } catch (ParserConfigurationException ex) {
867
+        } catch (final ParserConfigurationException ex) {
864 868
             if (isDebug()) {
865 869
                 handleError(ex, "* (10) getXML", apiInput, apiOutput);
866 870
             }
867
-        } catch (IOException ex) {
871
+        } catch (final IOException ex) {
868 872
             if (isDebug()) {
869 873
                 handleError(ex, "* (11) getXML", apiInput, apiOutput);
870 874
             }
@@ -879,7 +883,9 @@ public class TwitterAPI {
879 883
      * @param status
880 884
      */
881 885
     protected void uncacheStatus(final TwitterStatus status) {
882
-        if (status == null) { return; }
886
+        if (status == null) {
887
+            return;
888
+        }
883 889
         synchronized (statusCache) {
884 890
             statusCache.remove(status.getID());
885 891
         }
@@ -891,7 +897,9 @@ public class TwitterAPI {
891 897
      * @param user
892 898
      */
893 899
     protected void uncacheUser(final TwitterUser user) {
894
-        if (user == null) { return; }
900
+        if (user == null) {
901
+            return;
902
+        }
895 903
         synchronized (userCache) {
896 904
             userCache.remove(user.getScreenName().toLowerCase());
897 905
             userIDMap.remove(user.getID());
@@ -920,7 +928,9 @@ public class TwitterAPI {
920 928
      * @param user
921 929
      */
922 930
     protected void updateUser(final String username, final TwitterUser user) {
923
-        if (user == null) { return; }
931
+        if (user == null) {
932
+            return;
933
+        }
924 934
         synchronized (userCache) {
925 935
             if (!username.equalsIgnoreCase(user.getScreenName())) {
926 936
                 userCache.remove(username.toLowerCase());
@@ -971,9 +981,9 @@ public class TwitterAPI {
971 981
         TwitterUser user = getCachedUser(username);
972 982
         if (user == null || force) {
973 983
             if (username.equalsIgnoreCase(myDisplayUsername) && !isAllowed()) {
974
-                 user = new TwitterUser(this, myLoginUsername, -1, "", true);
984
+                user = new TwitterUser(this, myLoginUsername, -1, "", true);
975 985
             } else {
976
-                final XMLResponse doc = getXML(getURL("users/show")+"?screen_name="+username);
986
+                final XMLResponse doc = getXML(getURL("users/show") + "?screen_name=" + username);
977 987
 
978 988
                 if (doc.isGood()) {
979 989
                     user = new TwitterUser(this, doc.getDocumentElement());
@@ -982,7 +992,9 @@ public class TwitterAPI {
982 992
                 }
983 993
             }
984 994
 
985
-            if (user != null) { updateUser(user); }
995
+            if (user != null) {
996
+                updateUser(user);
997
+            }
986 998
         }
987 999
 
988 1000
         return user;
@@ -995,7 +1007,9 @@ public class TwitterAPI {
995 1007
      * @param status
996 1008
      */
997 1009
     protected void updateStatus(final TwitterStatus status) {
998
-        if (status == null) { return; }
1010
+        if (status == null) {
1011
+            return;
1012
+        }
999 1013
         synchronized (statusCache) {
1000 1014
             statusCache.put(status.getID(), status);
1001 1015
         }
@@ -1037,7 +1051,7 @@ public class TwitterAPI {
1037 1051
     public TwitterStatus getStatus(final long id, final boolean force) {
1038 1052
         TwitterStatus status = getCachedStatus(id);
1039 1053
         if (status == null || force) {
1040
-            final XMLResponse doc = getXML(getURL("statuses/show/"+id));
1054
+            final XMLResponse doc = getXML(getURL("statuses/show/" + id));
1041 1055
 
1042 1056
             if (doc.isGood()) {
1043 1057
                 status = new TwitterStatus(this, doc.getDocumentElement());
@@ -1061,7 +1075,7 @@ public class TwitterAPI {
1061 1075
         synchronized (statusCache) {
1062 1076
             final Map<Long, TwitterStatus> current = new HashMap<Long, TwitterStatus>(statusCache);
1063 1077
 
1064
-            for (Map.Entry<Long, TwitterStatus> item : current.entrySet()) {
1078
+            for (final Map.Entry<Long, TwitterStatus> item : current.entrySet()) {
1065 1079
                 if (item.getValue().getTime() < time) {
1066 1080
                     statusCache.remove(item.getKey());
1067 1081
                 }
@@ -1084,12 +1098,12 @@ public class TwitterAPI {
1084 1098
                 new TwitterMessage(this, doc.getDocumentElement());
1085 1099
                 return true;
1086 1100
             }
1087
-        } catch (UnsupportedEncodingException ex) {
1101
+        } catch (final UnsupportedEncodingException ex) {
1088 1102
             if (isDebug()) {
1089
-                handleError(ex, "* (1) newDirectMessage: "+target+" | "+message, apiInput, apiOutput);
1103
+                handleError(ex, "* (1) newDirectMessage: " + target + " | " + message, apiInput, apiOutput);
1090 1104
             }
1091 1105
         }
1092
-        
1106
+
1093 1107
         return false;
1094 1108
     }
1095 1109
 
@@ -1111,7 +1125,7 @@ public class TwitterAPI {
1111 1125
     public List<TwitterStatus> getUserTimeline(final long lastUserTimelineId) {
1112 1126
         final List<TwitterStatus> result = new ArrayList<TwitterStatus>();
1113 1127
 
1114
-        final XMLResponse doc = getXML(getURL("statuses/user_timeline")+"?since_id="+lastUserTimelineId+"&count=20");
1128
+        final XMLResponse doc = getXML(getURL("statuses/user_timeline") + "?since_id=" + lastUserTimelineId + "&count=20");
1115 1129
 
1116 1130
         if (doc.isGood()) {
1117 1131
             final NodeList nodes = doc.getElementsByTagName("status");
@@ -1145,8 +1159,7 @@ public class TwitterAPI {
1145 1159
         final List<TwitterStatus> result = new ArrayList<TwitterStatus>();
1146 1160
 
1147 1161
         try {
1148
-            final XMLResponse doc = getXML("http://search.twitter.com/search.atom?since_id="
1149
-                    +lastStatusId + "&rpp=100&q=" + URLEncoder.encode(term, "utf-8"));
1162
+            final XMLResponse doc = getXML("http://search.twitter.com/search.atom?since_id=" + lastStatusId + "&rpp=100&q=" + URLEncoder.encode(term, "utf-8"));
1150 1163
 
1151 1164
             if (doc.isGood()) {
1152 1165
                 final NodeList nodes = doc.getElementsByTagName("entry");
@@ -1161,13 +1174,13 @@ public class TwitterAPI {
1161 1174
                     result.add(0, new TwitterStatus(this, message, -1, id, user, time));
1162 1175
                 }
1163 1176
             }
1164
-        } catch (UnsupportedEncodingException ex) {
1177
+        } catch (final UnsupportedEncodingException ex) {
1165 1178
             if (isDebug()) {
1166
-                handleError(ex, "* (1) getSearchResults: "+term+" | "+lastStatusId, apiInput, apiOutput);
1179
+                handleError(ex, "* (1) getSearchResults: " + term + " | " + lastStatusId, apiInput, apiOutput);
1167 1180
             }
1168
-        } catch (ParseException ex) {
1181
+        } catch (final ParseException ex) {
1169 1182
             if (isDebug()) {
1170
-                handleError(ex, "* (2) getSearchResults: "+term+" | "+lastStatusId, apiInput, apiOutput);
1183
+                handleError(ex, "* (2) getSearchResults: " + term + " | " + lastStatusId, apiInput, apiOutput);
1171 1184
             }
1172 1185
         }
1173 1186
 
@@ -1283,7 +1296,7 @@ public class TwitterAPI {
1283 1296
     public List<TwitterStatus> getReplies(final long lastReplyId, final int count) {
1284 1297
         final List<TwitterStatus> result = new ArrayList<TwitterStatus>();
1285 1298
 
1286
-        final XMLResponse doc = getXML(getURL("statuses/mentions")+"?since_id="+lastReplyId+"&count="+count);
1299
+        final XMLResponse doc = getXML(getURL("statuses/mentions") + "?since_id=" + lastReplyId + "&count=" + count);
1287 1300
         if (doc.isGood()) {
1288 1301
             final NodeList nodes = doc.getElementsByTagName("status");
1289 1302
 
@@ -1304,7 +1317,7 @@ public class TwitterAPI {
1304 1317
     public List<TwitterStatus> getFriendsTimeline(final long lastTimelineId) {
1305 1318
         return getFriendsTimeline(lastTimelineId, 20);
1306 1319
     }
1307
-    
1320
+
1308 1321
     /**
1309 1322
      * Get the messages sent by friends that are later than the given ID.
1310 1323
      *
@@ -1315,7 +1328,7 @@ public class TwitterAPI {
1315 1328
     public List<TwitterStatus> getFriendsTimeline(final long lastTimelineId, final int count) {
1316 1329
         final List<TwitterStatus> result = new ArrayList<TwitterStatus>();
1317 1330
 
1318
-        final XMLResponse doc = getXML(getURL("statuses/home_timeline")+"?since_id="+lastTimelineId+"&count="+count);
1331
+        final XMLResponse doc = getXML(getURL("statuses/home_timeline") + "?since_id=" + lastTimelineId + "&count=" + count);
1319 1332
         if (doc.isGood()) {
1320 1333
             final NodeList nodes = doc.getElementsByTagName("status");
1321 1334
             for (int i = 0; i < nodes.getLength(); i++) {
@@ -1346,7 +1359,7 @@ public class TwitterAPI {
1346 1359
     public List<TwitterMessage> getDirectMessages(final long lastDirectMessageId, final int count) {
1347 1360
         final List<TwitterMessage> result = new ArrayList<TwitterMessage>();
1348 1361
 
1349
-        final XMLResponse doc = getXML(getURL("direct_messages")+"?since_id="+lastDirectMessageId+"&count="+count);
1362
+        final XMLResponse doc = getXML(getURL("direct_messages") + "?since_id=" + lastDirectMessageId + "&count=" + count);
1350 1363
         if (doc.isGood()) {
1351 1364
             final NodeList nodes = doc.getElementsByTagName("direct_message");
1352 1365
             for (int i = 0; i < nodes.getLength(); i++) {
@@ -1377,7 +1390,7 @@ public class TwitterAPI {
1377 1390
     public List<TwitterMessage> getSentDirectMessages(final long lastDirectMessageId, final int count) {
1378 1391
         final List<TwitterMessage> result = new ArrayList<TwitterMessage>();
1379 1392
 
1380
-        final XMLResponse doc = getXML(getURL("direct_messages/sent")+"?since_id="+lastDirectMessageId+"&count="+count);
1393
+        final XMLResponse doc = getXML(getURL("direct_messages/sent") + "?since_id=" + lastDirectMessageId + "&count=" + count);
1381 1394
         if (doc.isGood()) {
1382 1395
             final NodeList nodes = doc.getElementsByTagName("direct_message");
1383 1396
             for (int i = 0; i < nodes.getLength(); i++) {
@@ -1400,10 +1413,10 @@ public class TwitterAPI {
1400 1413
             final StringBuilder params = new StringBuilder("status=");
1401 1414
             params.append(URLEncoder.encode(status, "utf-8"));
1402 1415
             if (id >= 0) {
1403
-                params.append("&in_reply_to_status_id="+Long.toString(id));
1416
+                params.append("&in_reply_to_status_id=" + Long.toString(id));
1404 1417
             }
1405 1418
             if (!useOAuth) {
1406
-                params.append("&source="+URLEncoder.encode(mySource, "utf-8"));
1419
+                params.append("&source=" + URLEncoder.encode(mySource, "utf-8"));
1407 1420
             }
1408 1421
 
1409 1422
             final XMLResponse doc = postXML(getURL("statuses/update"), params.toString());
@@ -1413,13 +1426,13 @@ public class TwitterAPI {
1413 1426
                 }
1414 1427
                 return true;
1415 1428
             }
1416
-        } catch (UnsupportedEncodingException ex) {
1429
+        } catch (final UnsupportedEncodingException ex) {
1417 1430
             if (isDebug()) {
1418
-                handleError(ex, "* (1) setStatus: "+status+" | "+id, apiInput, apiOutput);
1431
+                handleError(ex, "* (1) setStatus: " + status + " | " + id, apiInput, apiOutput);
1419 1432
             }
1420
-        } catch (IOException ex) {
1433
+        } catch (final IOException ex) {
1421 1434
             if (isDebug()) {
1422
-                handleError(ex, "* (2) setStatus: "+status+" | "+id, apiInput, apiOutput);
1435
+                handleError(ex, "* (2) setStatus: " + status + " | " + id, apiInput, apiOutput);
1423 1436
             }
1424 1437
         }
1425 1438
 
@@ -1433,7 +1446,7 @@ public class TwitterAPI {
1433 1446
      * @return True if status was retweeted ok.
1434 1447
      */
1435 1448
     public boolean retweetStatus(final TwitterStatus status) {
1436
-        final XMLResponse doc = postXML(getURL("statuses/retweet/"+status.getID()));
1449
+        final XMLResponse doc = postXML(getURL("statuses/retweet/" + status.getID()));
1437 1450
         if (doc.getResponseCode() == 200) {
1438 1451
             if (doc.isGood()) {
1439 1452
                 new TwitterStatus(this, doc.getDocumentElement());
@@ -1451,7 +1464,7 @@ public class TwitterAPI {
1451 1464
      * @return True if status was deleted ok.
1452 1465
      */
1453 1466
     public boolean deleteStatus(final TwitterStatus status) {
1454
-        final XMLResponse doc = postXML(getURL("statuses/destroy/"+status.getID()));
1467
+        final XMLResponse doc = postXML(getURL("statuses/destroy/" + status.getID()));
1455 1468
         if (doc.getResponseCode() == 200) {
1456 1469
             if (doc.isGood()) {
1457 1470
                 final TwitterStatus deletedStatus = new TwitterStatus(this, doc.getDocumentElement());
@@ -1485,7 +1498,7 @@ public class TwitterAPI {
1485 1498
 
1486 1499
             final long remaining = parseLong(getElementContents(element, "remaining-hits", ""), -1);
1487 1500
             final long total = parseLong(getElementContents(element, "hourly-limit", ""), -1);
1488
-            
1501
+
1489 1502
             // laconica does this wrong :( so support both.
1490 1503
             final String resetTimeString = getElementContents(element, "reset-time-in-seconds", getElementContents(element, "reset_time_in_seconds", "0"));
1491 1504
             resetTime = 1000 * parseLong(resetTimeString, -1);
@@ -1514,28 +1527,28 @@ public class TwitterAPI {
1514 1527
     public String getOAuthURL() throws TwitterRuntimeException {
1515 1528
         try {
1516 1529
             return provider.retrieveRequestToken(OAuth.OUT_OF_BAND);
1517
-        } catch (OAuthMessageSignerException ex) {
1530
+        } catch (final OAuthMessageSignerException ex) {
1518 1531
             if (myPassword.isEmpty()) {
1519 1532
                 if (isDebug()) {
1520 1533
                     handleError(ex, "* (1) getOAuthURL", apiInput, apiOutput);
1521 1534
                 }
1522 1535
                 throw new TwitterRuntimeException(ex.getMessage(), ex);
1523 1536
             }
1524
-        } catch (OAuthNotAuthorizedException ex) {
1537
+        } catch (final OAuthNotAuthorizedException ex) {
1525 1538
             if (myPassword.isEmpty()) {
1526 1539
                 if (isDebug()) {
1527 1540
                     handleError(ex, "* (2) getOAuthURL", apiInput, apiOutput);
1528 1541
                 }
1529 1542
                 throw new TwitterRuntimeException(ex.getMessage(), ex);
1530 1543
             }
1531
-        } catch (OAuthExpectationFailedException ex) {
1544
+        } catch (final OAuthExpectationFailedException ex) {
1532 1545
             if (myPassword.isEmpty()) {
1533 1546
                 if (isDebug()) {
1534 1547
                     handleError(ex, "* (3) getOAuthURL", apiInput, apiOutput);
1535 1548
                 }
1536 1549
                 throw new TwitterRuntimeException(ex.getMessage(), ex);
1537 1550
             }
1538
-        } catch (OAuthCommunicationException ex) {
1551
+        } catch (final OAuthCommunicationException ex) {
1539 1552
             if (myPassword.isEmpty()) {
1540 1553
                 if (isDebug()) {
1541 1554
                     handleError(ex, "* (4) getOAuthURL", apiInput, apiOutput);
@@ -1555,29 +1568,31 @@ public class TwitterAPI {
1555 1568
      * @throws TwitterException  if there is a problem with OAuth.
1556 1569
      */
1557 1570
     public void setAccessPin(final String pin) throws TwitterException {
1558
-        if (!useOAuth) { return; }
1571
+        if (!useOAuth) {
1572
+            return;
1573
+        }
1559 1574
         try {
1560 1575
             provider.retrieveAccessToken(pin);
1561 1576
             token = consumer.getToken();
1562 1577
             tokenSecret = consumer.getTokenSecret();
1563
-        } catch (OAuthMessageSignerException ex) {
1578
+        } catch (final OAuthMessageSignerException ex) {
1564 1579
             if (isDebug()) {
1565
-                handleError(ex, "* (1) setAccessPin: "+pin, apiInput, apiOutput);
1580
+                handleError(ex, "* (1) setAccessPin: " + pin, apiInput, apiOutput);
1566 1581
             }
1567 1582
             throw new TwitterException(ex.getMessage(), ex);
1568
-        } catch (OAuthNotAuthorizedException ex) {
1583
+        } catch (final OAuthNotAuthorizedException ex) {
1569 1584
             if (isDebug()) {
1570
-                handleError(ex, "* (2) setAccessPin: "+pin, apiInput, apiOutput);
1585
+                handleError(ex, "* (2) setAccessPin: " + pin, apiInput, apiOutput);
1571 1586
             }
1572 1587
             throw new TwitterException(ex.getMessage(), ex);
1573
-        } catch (OAuthExpectationFailedException ex) {
1588
+        } catch (final OAuthExpectationFailedException ex) {
1574 1589
             if (isDebug()) {
1575
-                handleError(ex, "* (3) setAccessPin: "+pin, apiInput, apiOutput);
1590
+                handleError(ex, "* (3) setAccessPin: " + pin, apiInput, apiOutput);
1576 1591
             }
1577 1592
             throw new TwitterException(ex.getMessage(), ex);
1578
-        } catch (OAuthCommunicationException ex) {
1593
+        } catch (final OAuthCommunicationException ex) {
1579 1594
             if (isDebug()) {
1580
-                handleError(ex, "* (4) setAccessPin: "+pin, apiInput, apiOutput);
1595
+                handleError(ex, "* (4) setAccessPin: " + pin, apiInput, apiOutput);
1581 1596
             }
1582 1597
             throw new TwitterException(ex.getMessage(), ex);
1583 1598
         }
@@ -1618,7 +1633,9 @@ public class TwitterAPI {
1618 1633
      * @return true if we have been authorised, else false.
1619 1634
      */
1620 1635
     public boolean isAllowed(final boolean forceRecheck) {
1621
-        if (myLoginUsername.isEmpty()) { return false; }
1636
+        if (myLoginUsername.isEmpty()) {
1637
+            return false;
1638
+        }
1622 1639
 
1623 1640
         if ((useOAuth && (getToken().isEmpty() || getTokenSecret().isEmpty())) || (!useOAuth && myPassword.isEmpty())) {
1624 1641
             return false;
@@ -1635,7 +1652,7 @@ public class TwitterAPI {
1635 1652
                     updateUser(user);
1636 1653
                     getRemainingApiCalls();
1637 1654
                 }
1638
-            } catch (IOException ex) {
1655
+            } catch (final IOException ex) {
1639 1656
                 if (isDebug()) {
1640 1657
                     handleError(ex, "* (1) isAllowed", apiInput, apiOutput);
1641 1658
                 }
@@ -1660,9 +1677,9 @@ public class TwitterAPI {
1660 1677
                 updateUser(user);
1661 1678
                 return user;
1662 1679
             }
1663
-        } catch (UnsupportedEncodingException ex) {
1680
+        } catch (final UnsupportedEncodingException ex) {
1664 1681
             if (isDebug()) {
1665
-                handleError(ex, "* (1) addFriend: "+name, apiInput, apiOutput);
1682
+                handleError(ex, "* (1) addFriend: " + name, apiInput, apiOutput);
1666 1683
             }
1667 1684
         }
1668 1685
 
@@ -1684,9 +1701,9 @@ public class TwitterAPI {
1684 1701
 
1685 1702
                 return user;
1686 1703
             }
1687
-        } catch (UnsupportedEncodingException ex) {
1704
+        } catch (final UnsupportedEncodingException ex) {
1688 1705
             if (isDebug()) {
1689
-                handleError(ex, "* (1) delFriend: "+name, apiInput, apiOutput);
1706
+                handleError(ex, "* (1) delFriend: " + name, apiInput, apiOutput);
1690 1707
             }
1691 1708
         }
1692 1709
 
@@ -1708,9 +1725,9 @@ public class TwitterAPI {
1708 1725
 
1709 1726
                 return user;
1710 1727
             }
1711
-        } catch (UnsupportedEncodingException ex) {
1728
+        } catch (final UnsupportedEncodingException ex) {
1712 1729
             if (isDebug()) {
1713
-                handleError(ex, "*(1) blockUser: "+name, apiInput, apiOutput);
1730
+                handleError(ex, "*(1) blockUser: " + name, apiInput, apiOutput);
1714 1731
             }
1715 1732
         }
1716 1733
 
@@ -1732,12 +1749,13 @@ public class TwitterAPI {
1732 1749
 
1733 1750
                 return user;
1734 1751
             }
1735
-        } catch (UnsupportedEncodingException ex) {
1752
+        } catch (final UnsupportedEncodingException ex) {
1736 1753
             if (isDebug()) {
1737
-                handleError(ex, "* (1) unblockUser: "+name, apiInput, apiOutput);
1754
+                handleError(ex, "* (1) unblockUser: " + name, apiInput, apiOutput);
1738 1755
             }
1739 1756
         }
1740 1757
 
1741 1758
         return null;
1742 1759
     }
1760
+
1743 1761
 }

+ 3
- 1
src/com/dmdirc/addons/parser_twitter/api/TwitterErrorHandler.java 查看文件

@@ -28,6 +28,7 @@ package com.dmdirc.addons.parser_twitter.api;
28 28
  * @author shane
29 29
  */
30 30
 public interface TwitterErrorHandler {
31
+
31 32
     /**
32 33
      * Handle an error from the Twitter API.
33 34
      *
@@ -38,5 +39,6 @@ public interface TwitterErrorHandler {
38 39
      * @param twitterOutput The output from the API that caused this error.
39 40
      * @param message If more information should be relayed to the user, it comes here
40 41
      */
41
-     void handleTwitterError(final TwitterAPI api, final Throwable t, final String source, final String twitterInput, final String twitterOutput, final String message);
42
+    void handleTwitterError(final TwitterAPI api, final Throwable t, final String source, final String twitterInput, final String twitterOutput, final String message);
43
+
42 44
 }

+ 7
- 3
src/com/dmdirc/addons/parser_twitter/api/TwitterMessage.java 查看文件

@@ -32,6 +32,7 @@ import org.w3c.dom.NodeList;
32 32
  * @author shane
33 33
  */
34 34
 public class TwitterMessage implements Comparable<TwitterMessage> {
35
+
35 36
     /** ID of this message. */
36 37
     final long id;
37 38
 
@@ -40,7 +41,7 @@ public class TwitterMessage implements Comparable<TwitterMessage> {
40 41
 
41 42
     /** Owner of this message. */
42 43
     final String sender;
43
-    
44
+
44 45
     /** Target of this message. */
45 46
     final String target;
46 47
 
@@ -86,7 +87,9 @@ public class TwitterMessage implements Comparable<TwitterMessage> {
86 87
      * @param node Node to use.
87 88
      */
88 89
     protected TwitterMessage(final TwitterAPI api, final Node node) {
89
-        if (!(node instanceof Element)) { throw new TwitterRuntimeException("Can only use Element type nodes for message creation."); }
90
+        if (!(node instanceof Element)) {
91
+            throw new TwitterRuntimeException("Can only use Element type nodes for message creation.");
92
+        }
90 93
         this.myAPI = api;
91 94
         final Element element = (Element) node;
92 95
 
@@ -154,7 +157,7 @@ public class TwitterMessage implements Comparable<TwitterMessage> {
154 157
     public TwitterUser getTarget() {
155 158
         return myAPI.getCachedUser(target);
156 159
     }
157
-    
160
+
158 161
     /**
159 162
      * Get the ID of this message.
160 163
      *
@@ -223,4 +226,5 @@ public class TwitterMessage implements Comparable<TwitterMessage> {
223 226
             return 0;
224 227
         }
225 228
     }
229
+
226 230
 }

+ 4
- 2
src/com/dmdirc/addons/parser_twitter/api/TwitterRawHandler.java 查看文件

@@ -28,13 +28,14 @@ package com.dmdirc.addons.parser_twitter.api;
28 28
  * @author shane
29 29
  */
30 30
 public interface TwitterRawHandler {
31
+
31 32
     /**
32 33
      * Handle input from twitter.
33 34
      *
34 35
      * @param api the TwitterAPI that recieved this input.
35 36
      * @param data The raw data to handle.
36 37
      */
37
-     void handleRawTwitterInput(final TwitterAPI api, final String data);
38
+    void handleRawTwitterInput(final TwitterAPI api, final String data);
38 39
 
39 40
     /**
40 41
      * Handle an output to twitter.
@@ -42,5 +43,6 @@ public interface TwitterRawHandler {
42 43
      * @param api the TwitterAPI that sent this output.
43 44
      * @param data The raw data to handle.
44 45
      */
45
-     void handleRawTwitterOutput(final TwitterAPI api, final String data);
46
+    void handleRawTwitterOutput(final TwitterAPI api, final String data);
47
+
46 48
 }

+ 6
- 3
src/com/dmdirc/addons/parser_twitter/api/TwitterStatus.java 查看文件

@@ -34,6 +34,7 @@ import org.w3c.dom.NodeList;
34 34
  * @author shane
35 35
  */
36 36
 public class TwitterStatus implements Comparable<TwitterStatus> {
37
+
37 38
     /** The ID this message was in reply to. */
38 39
     private long replyID;
39 40
 
@@ -116,7 +117,9 @@ public class TwitterStatus implements Comparable<TwitterStatus> {
116 117
      * @param user User who this status belongs to.
117 118
      */
118 119
     protected TwitterStatus(final TwitterAPI api, final Node node, final String user) {
119
-        if (!(node instanceof Element)) { throw new TwitterRuntimeException("Can only use Element type nodes for status creation."); }
120
+        if (!(node instanceof Element)) {
121
+            throw new TwitterRuntimeException("Can only use Element type nodes for status creation.");
122
+        }
120 123
         this.myAPI = api;
121 124
         final Element element = (Element) node;
122 125
 
@@ -135,7 +138,7 @@ public class TwitterStatus implements Comparable<TwitterStatus> {
135 138
 
136 139
         this.id = TwitterAPI.parseLong(TwitterAPI.getElementContents(element, "id", ""), -1);
137 140
         this.replyID = TwitterAPI.parseLong(TwitterAPI.getElementContents(element, "in_reply_to_status_id", ""), -1);
138
-        
141
+
139 142
         this.time = TwitterAPI.timeStringToLong(TwitterAPI.getElementContents(element, "created_at", ""), 0);
140 143
 
141 144
         final TwitterUser userUser;
@@ -156,7 +159,6 @@ public class TwitterStatus implements Comparable<TwitterStatus> {
156 159
         api.updateStatus(this);
157 160
     }
158 161
 
159
-
160 162
     /**
161 163
      * Get the ID of this message
162 164
      *
@@ -294,4 +296,5 @@ public class TwitterStatus implements Comparable<TwitterStatus> {
294 296
             return 0;
295 297
         }
296 298
     }
299
+
297 300
 }

+ 7
- 6
src/com/dmdirc/addons/parser_twitter/api/TwitterUser.java 查看文件

@@ -31,12 +31,13 @@ import org.w3c.dom.NodeList;
31 31
  * @author shane
32 32
  */
33 33
 public class TwitterUser {
34
+
34 35
     /** What is the screen name of this user? */
35 36
     private final String screenName;
36 37
 
37 38
     /** What is the user id of this user? */
38 39
     private final long userID;
39
-    
40
+
40 41
     /** What is the real name of this user? */
41 42
     private final String realName;
42 43
 
@@ -118,14 +119,16 @@ public class TwitterUser {
118 119
      * @param status Status to use
119 120
      */
120 121
     protected TwitterUser(final TwitterAPI api, final Node node, final TwitterStatus status) {
121
-        if (!(node instanceof Element)) { throw new TwitterRuntimeException("Can only use Element type nodes for user creation."); }
122
+        if (!(node instanceof Element)) {
123
+            throw new TwitterRuntimeException("Can only use Element type nodes for user creation.");
124
+        }
122 125
 
123 126
         final Element element = (Element) node;
124 127
         this.myAPI = api;
125 128
 
126 129
         this.realName = TwitterAPI.getElementContents(element, "name", "");
127 130
         this.screenName = (api.autoAt() ? "@" : "") + TwitterAPI.getElementContents(element, "screen_name", "");
128
-        
131
+
129 132
         this.myProfilePicture = TwitterAPI.getElementContents(element, "profile_image_url", "");
130 133
         this.myURL = TwitterAPI.getElementContents(element, "url", "");
131 134
         this.myLocation = TwitterAPI.getElementContents(element, "location", "");
@@ -179,7 +182,6 @@ public class TwitterUser {
179 182
         this.lastStatus = newStatus;
180 183
     }
181 184
 
182
-
183 185
     /**
184 186
      * Get the screen name for this user.
185 187
      *
@@ -188,7 +190,7 @@ public class TwitterUser {
188 190
     public String getScreenName() {
189 191
         return screenName;
190 192
     }
191
-    
193
+
192 194
     /**
193 195
      * Get the id for this user.
194 196
      * 
@@ -288,5 +290,4 @@ public class TwitterUser {
288 290
         return myRegisteredTime;
289 291
     }
290 292
 
291
-
292 293
 }

+ 5
- 3
src/com/dmdirc/addons/parser_twitter/api/XMLResponse.java 查看文件

@@ -98,8 +98,8 @@ public class XMLResponse {
98 98
                     if (request.getResponseCode() != 200) {
99 99
                         return "(" + request.getResponseCode() + ") " + request.getResponseMessage();
100 100
                     }
101
-                } catch (IOException ex) {
102
-                    return "Error obtaining response code: "+ex;
101
+                } catch (final IOException ex) {
102
+                    return "Error obtaining response code: " + ex;
103 103
                 }
104 104
             } else {
105 105
                 return error;
@@ -137,7 +137,8 @@ public class XMLResponse {
137 137
         if (request != null) {
138 138
             try {
139 139
                 return request.getResponseCode();
140
-            } catch (IOException ex) { }
140
+            } catch (final IOException ex) {
141
+            }
141 142
         }
142 143
 
143 144
         return 0;
@@ -153,4 +154,5 @@ public class XMLResponse {
153 154
     public boolean isGood() {
154 155
         return getResponseCode() == 200 && getDocument() != null && !isError();
155 156
     }
157
+
156 158
 }

+ 14
- 13
src/com/dmdirc/addons/parser_twitter/api/commons/Entities.java 查看文件

@@ -150,9 +150,9 @@ class Entities {
150 150
     };
151 151
 
152 152
     // package scoped for testing
153
-    static final int ISO8859_1_ARRAY_LENGTH = ISO8859_1_ARRAY.length;
153
+    static int ISO8859_1_ARRAY_LENGTH = ISO8859_1_ARRAY.length;
154 154
     
155
-    static String getISO88591(int i, int j) {
155
+    static String getISO8859_1(int i, int j) {
156 156
         return ISO8859_1_ARRAY[i][j];
157 157
     }
158 158
 
@@ -355,7 +355,7 @@ class Entities {
355 355
     };
356 356
     
357 357
     // package scoped for testing
358
-    static final int HTML40_ARRAY_LENGTH = HTML40_ARRAY.length;
358
+    static int HTML40_ARRAY_LENGTH = HTML40_ARRAY.length;
359 359
     
360 360
     static String getHTML40(int i, int j) {
361 361
         return HTML40_ARRAY[i][j];
@@ -458,7 +458,7 @@ class Entities {
458 458
          * {@inheritDoc}
459 459
          */
460 460
         public void add(String name, int value) {
461
-            mapNameToValue.put(name, value);
461
+            mapNameToValue.put(name, new Integer(value));
462 462
             mapValueToName.put(value, name);
463 463
         }
464 464
 
@@ -481,7 +481,7 @@ class Entities {
481 481
         }
482 482
     }
483 483
 
484
-    abstract static class MapIntMap implements Entities.EntityMap {
484
+    static abstract class MapIntMap implements Entities.EntityMap {
485 485
         protected Map<String, Integer> mapNameToValue;
486 486
 
487 487
         protected Map<Integer, String> mapValueToName;
@@ -490,15 +490,15 @@ class Entities {
490 490
          * {@inheritDoc}
491 491
          */
492 492
         public void add(String name, int value) {
493
-            mapNameToValue.put(name, value);
494
-            mapValueToName.put(value, name);
493
+            mapNameToValue.put(name, new Integer(value));
494
+            mapValueToName.put(new Integer(value), name);
495 495
         }
496 496
 
497 497
         /**
498 498
          * {@inheritDoc}
499 499
          */
500 500
         public String name(int value) {
501
-            return mapValueToName.get(value);
501
+            return mapValueToName.get(new Integer(value));
502 502
         }
503 503
 
504 504
         /**
@@ -536,7 +536,7 @@ class Entities {
536 536
     static class LookupEntityMap extends PrimitiveEntityMap {
537 537
         private String[] lookupTable;
538 538
 
539
-        private static final int LOOKUP_TABLE_SIZE = 256;
539
+        private int LOOKUP_TABLE_SIZE = 256;
540 540
 
541 541
         /**
542 542
          * {@inheritDoc}
@@ -972,13 +972,14 @@ class Entities {
972 972
                             char isHexChar = entityContent.charAt(1);
973 973
                             try {
974 974
                                 switch (isHexChar) {
975
-                                    case 'X':
976
-                                    case 'x':
975
+                                    case 'X' :
976
+                                    case 'x' : {
977 977
                                         entityValue = Integer.parseInt(entityContent.substring(2), 16);
978 978
                                         break;
979
-                                    default:
979
+                                    }
980
+                                    default : {
980 981
                                         entityValue = Integer.parseInt(entityContent.substring(1), 10);
981
-                                        break;
982
+                                    }
982 983
                                 }
983 984
                                 if (entityValue > 0xFFFF) {
984 985
                                     entityValue = -1;

+ 9
- 9
src/com/dmdirc/addons/parser_twitter/api/commons/IntHashMap.java 查看文件

@@ -40,7 +40,7 @@ class IntHashMap {
40 40
     /**
41 41
      * The hash table data.
42 42
      */
43
-    private transient Entry[] table;
43
+    private transient Entry table[];
44 44
 
45 45
     /**
46 46
      * The total number of entries in the hash table.
@@ -176,7 +176,7 @@ class IntHashMap {
176 176
             throw new NullPointerException();
177 177
         }
178 178
 
179
-        Entry[] tab = table;
179
+        Entry tab[] = table;
180 180
         for (int i = tab.length; i-- > 0;) {
181 181
             for (Entry e = tab[i]; e != null; e = e.next) {
182 182
                 if (e.value.equals(value)) {
@@ -213,7 +213,7 @@ class IntHashMap {
213 213
      * @see #contains(Object)
214 214
      */
215 215
     public boolean containsKey(int key) {
216
-        Entry[] tab = table;
216
+        Entry tab[] = table;
217 217
         int hash = key;
218 218
         int index = (hash & 0x7FFFFFFF) % tab.length;
219 219
         for (Entry e = tab[index]; e != null; e = e.next) {
@@ -234,7 +234,7 @@ class IntHashMap {
234 234
      * @see     #put(int, Object)
235 235
      */
236 236
     public Object get(int key) {
237
-        Entry[] tab = table;
237
+        Entry tab[] = table;
238 238
         int hash = key;
239 239
         int index = (hash & 0x7FFFFFFF) % tab.length;
240 240
         for (Entry e = tab[index]; e != null; e = e.next) {
@@ -256,10 +256,10 @@ class IntHashMap {
256 256
      */
257 257
     protected void rehash() {
258 258
         int oldCapacity = table.length;
259
-        Entry[] oldMap = table;
259
+        Entry oldMap[] = table;
260 260
 
261 261
         int newCapacity = oldCapacity * 2 + 1;
262
-        Entry[] newMap = new Entry[newCapacity];
262
+        Entry newMap[] = new Entry[newCapacity];
263 263
 
264 264
         threshold = (int) (newCapacity * loadFactor);
265 265
         table = newMap;
@@ -293,7 +293,7 @@ class IntHashMap {
293 293
      */
294 294
     public Object put(int key, Object value) {
295 295
         // Makes sure the key is not already in the hashtable.
296
-        Entry[] tab = table;
296
+        Entry tab[] = table;
297 297
         int hash = key;
298 298
         int index = (hash & 0x7FFFFFFF) % tab.length;
299 299
         for (Entry e = tab[index]; e != null; e = e.next) {
@@ -331,7 +331,7 @@ class IntHashMap {
331 331
      *          or <code>null</code> if the key did not have a mapping.
332 332
      */
333 333
     public Object remove(int key) {
334
-        Entry[] tab = table;
334
+        Entry tab[] = table;
335 335
         int hash = key;
336 336
         int index = (hash & 0x7FFFFFFF) % tab.length;
337 337
         for (Entry e = tab[index], prev = null; e != null; prev = e, e = e.next) {
@@ -354,7 +354,7 @@ class IntHashMap {
354 354
      * <p>Clears this hashtable so that it contains no keys.</p>
355 355
      */
356 356
     public synchronized void clear() {
357
-        Entry[] tab = table;
357
+        Entry tab[] = table;
358 358
         for (int index = tab.length; --index >= 0;) {
359 359
             tab[index] = null;
360 360
         }

+ 6
- 6
src/com/dmdirc/addons/parser_twitter/api/commons/StringEscapeUtils.java 查看文件

@@ -70,7 +70,7 @@ public class StringEscapeUtils {
70 70
             return null;
71 71
         }
72 72
         try {
73
-            StringWriter writer = new StringWriter((int) (str.length() * 1.5));
73
+            StringWriter writer = new StringWriter ((int)(str.length() * 1.5));
74 74
             escapeHtml(writer, str);
75 75
             return writer.toString();
76 76
         } catch (IOException ioe) {
@@ -109,8 +109,8 @@ public class StringEscapeUtils {
109 109
      * @see <a href="http://www.w3.org/TR/html401/charset.html#code-position">HTML 4.01 Code positions</a>
110 110
      */
111 111
     public static void escapeHtml(Writer writer, String string) throws IOException {
112
-        if (writer == null) {
113
-            throw new IllegalArgumentException("The Writer must not be null.");
112
+        if (writer == null ) {
113
+            throw new IllegalArgumentException ("The Writer must not be null.");
114 114
         }
115 115
         if (string == null) {
116 116
             return;
@@ -140,7 +140,7 @@ public class StringEscapeUtils {
140 140
             return null;
141 141
         }
142 142
         try {
143
-            StringWriter writer = new StringWriter((int) (str.length() * 1.5));
143
+            StringWriter writer = new StringWriter ((int)(str.length() * 1.5));
144 144
             unescapeHtml(writer, str);
145 145
             return writer.toString();
146 146
         } catch (IOException ioe) {
@@ -168,8 +168,8 @@ public class StringEscapeUtils {
168 168
      * @see #escapeHtml(String)
169 169
      */
170 170
     public static void unescapeHtml(Writer writer, String string) throws IOException {
171
-        if (writer == null) {
172
-            throw new IllegalArgumentException("The Writer must not be null.");
171
+        if (writer == null ) {
172
+            throw new IllegalArgumentException ("The Writer must not be null.");
173 173
         }
174 174
         if (string == null) {
175 175
             return;

+ 4
- 3
src/com/dmdirc/addons/parser_twitter/plugin.config 查看文件

@@ -21,18 +21,19 @@ updates:
21 21
   id=49
22 22
 
23 23
 version:
24
-  number=27
25
-  friendly=2.7
24
+  number=28
25
+  friendly=2.8
26 26
 
27 27
 defaults:
28 28
   statuscount=20
29
-  apicalls=60
29
+  apicalls=175
30 30
   debugEnabled=false
31 31
   hide500Errors=true
32 32
   saveLastIDs=false
33 33
   getSentMessages=false
34 34
   replaceOpeningNickname=false
35 35
   autoAt=false
36
+  autoLeaveMessageChannel=false
36 37
   # Pre-configured support for twitter api
37 38
   api.address.twitter.com=api.twitter.com
38 39
   api.versioned.twitter.com=true

Loading…
取消
儲存