Bläddra i källkod

Style fixes

Change-Id: Icfab1de147645d80a999c3678daf268e7e115066
Reviewed-on: http://gerrit.dmdirc.com/1331
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
Reviewed-by: Gregory Holmes <greg@dmdirc.com>
tags/0.6.4rc1
Chris Smith 14 år sedan
förälder
incheckning
6e42762d67
49 ändrade filer med 377 tillägg och 388 borttagningar
  1. 1
    7
      src/com/dmdirc/CertificateManager.java
  2. 1
    1
      src/com/dmdirc/ServerManager.java
  3. 54
    54
      src/com/dmdirc/actions/ActionManager.java
  4. 0
    1
      src/com/dmdirc/actions/internal/WhoisNumericFormatter.java
  5. 6
    4
      src/com/dmdirc/actions/wrappers/PerformWrapper.java
  6. 9
    9
      src/com/dmdirc/commandparser/CommandManager.java
  7. 1
    1
      src/com/dmdirc/config/CipherUtils.java
  8. 3
    3
      src/com/dmdirc/config/ConfigManager.java
  9. 28
    28
      src/com/dmdirc/config/IdentityManager.java
  10. 5
    5
      src/com/dmdirc/installer/Settings.java
  11. 3
    3
      src/com/dmdirc/installer/Step.java
  12. 15
    13
      src/com/dmdirc/installer/TextStep.java
  13. 1
    1
      src/com/dmdirc/installer/WindowsInstaller.java
  14. 62
    61
      src/com/dmdirc/installer/cliparser/CLIParam.java
  15. 1
    1
      src/com/dmdirc/installer/cliparser/CLIParser.java
  16. 43
    42
      src/com/dmdirc/installer/cliparser/StringParam.java
  17. 10
    10
      src/com/dmdirc/installer/ui/StepSettings.java
  18. 3
    3
      src/com/dmdirc/logger/ErrorManager.java
  19. 6
    6
      src/com/dmdirc/logger/Logger.java
  20. 3
    3
      src/com/dmdirc/logger/ProgramError.java
  21. 1
    1
      src/com/dmdirc/plugins/GlobalClassLoader.java
  22. 1
    1
      src/com/dmdirc/plugins/PluginManager.java
  23. 26
    26
      src/com/dmdirc/ui/WindowManager.java
  24. 3
    3
      src/com/dmdirc/ui/core/util/URLHandler.java
  25. 0
    1
      src/com/dmdirc/ui/interfaces/InputWindow.java
  26. 2
    2
      src/com/dmdirc/ui/interfaces/SearchBar.java
  27. 0
    1
      src/com/dmdirc/ui/interfaces/UIController.java
  28. 0
    1
      src/com/dmdirc/ui/interfaces/Window.java
  29. 5
    5
      src/com/dmdirc/ui/messages/ColourManager.java
  30. 4
    4
      src/com/dmdirc/ui/messages/Formatter.java
  31. 6
    4
      src/com/dmdirc/ui/messages/IRCDocument.java
  32. 1
    1
      src/com/dmdirc/ui/messages/Line.java
  33. 32
    32
      src/com/dmdirc/updater/UpdateChecker.java
  34. 6
    6
      src/com/dmdirc/updater/Version.java
  35. 3
    3
      src/com/dmdirc/updater/components/PluginComponent.java
  36. 9
    9
      src/net/miginfocom/Base64.java
  37. 0
    3
      test/com/dmdirc/ServerManagerTest.java
  38. 1
    1
      test/com/dmdirc/TopicTest.java
  39. 3
    6
      test/com/dmdirc/actions/ActionComponentChainTest.java
  40. 8
    8
      test/com/dmdirc/actions/ActionSubstitutorTest.java
  41. 0
    1
      test/com/dmdirc/commandparser/commands/chat/MeTest.java
  42. 1
    5
      test/com/dmdirc/commandparser/parsers/CommandParserTest.java
  43. 0
    1
      test/com/dmdirc/commandparser/parsers/GlobalCommandParserTest.java
  44. 1
    1
      test/com/dmdirc/config/prefs/PluginPreferencesCategoryTest.java
  45. 0
    1
      test/com/dmdirc/harness/TestCommandParser.java
  46. 6
    1
      test/com/dmdirc/logger/NullOutputStreamTest.java
  47. 1
    1
      test/com/dmdirc/ui/WindowManagerTest.java
  48. 0
    1
      test/com/dmdirc/ui/messages/ColourManagerTest.java
  49. 2
    2
      test/com/dmdirc/updater/UpdateTest.java

+ 1
- 7
src/com/dmdirc/CertificateManager.java Visa fil

@@ -152,13 +152,7 @@ public class CertificateManager implements X509TrustManager {
152 152
         } catch (NoSuchAlgorithmException ex) {
153 153
             Logger.userError(ErrorLevel.MEDIUM, "Unable to load trusted certificates", ex);
154 154
         } finally {
155
-            if (is != null) {
156
-                try {
157
-                    is.close();
158
-                } catch (IOException ex) {
159
-                    // ...
160
-                }
161
-            }
155
+            StreamUtil.close(is);
162 156
         }
163 157
     }
164 158
 

+ 1
- 1
src/com/dmdirc/ServerManager.java Visa fil

@@ -251,7 +251,7 @@ public final class ServerManager {
251 251
         server.activateFrame();
252 252
 
253 253
         if (server.getState().isDisconnected()) {
254
-            server.connect(uri, profile );
254
+            server.connect(uri, profile);
255 255
         } else {
256 256
             server.join(server.getParser().extractChannels(uri)
257 257
                     .toArray(new ChannelJoinRequest[0]));

+ 54
- 54
src/com/dmdirc/actions/ActionManager.java Visa fil

@@ -54,35 +54,35 @@ import java.util.Map;
54 54
 public final class ActionManager {
55 55
 
56 56
     /** A list of registered action types. */
57
-    private static final List<ActionType> actionTypes
57
+    private static final List<ActionType> ACTION_TYPES
58 58
             = new ArrayList<ActionType>();
59 59
 
60 60
     /** A list of registered action components. */
61
-    private static final List<ActionComponent> actionComponents
61
+    private static final List<ActionComponent> ACTION_COMPONENTS
62 62
             = new ArrayList<ActionComponent>();
63 63
 
64 64
     /** A list of registered action comparisons. */
65
-    private static final List<ActionComparison> actionComparisons
65
+    private static final List<ActionComparison> ACTION_COMPARISON
66 66
             = new ArrayList<ActionComparison>();
67 67
 
68 68
     /** A map linking types and a list of actions that're registered for them. */
69
-    private static final MapList<ActionType, Action> actions
69
+    private static final MapList<ActionType, Action> ACTIONS
70 70
             = new MapList<ActionType, Action>();
71 71
 
72 72
     /** A map linking groups and a list of actions that're in them. */
73
-    private static final Map<String, ActionGroup> groups
73
+    private static final Map<String, ActionGroup> GROUPS
74 74
             = new HashMap<String, ActionGroup>();
75 75
 
76 76
     /** A map of objects to synchronise on for concurrency groups. */
77
-    private static final Map<String, Object> locks
77
+    private static final Map<String, Object> LOCKS
78 78
             = new HashMap<String, Object>();
79 79
 
80 80
     /** A map of the action type groups to the action types within. */
81
-    private static final MapList<String, ActionType> actionTypeGroups
81
+    private static final MapList<String, ActionType> ACTIONTYPE_GROUPS
82 82
             = new MapList<String, ActionType>();
83 83
 
84 84
     /** The listeners that we have registered. */
85
-    private static final MapList<ActionType, ActionListener> listeners
85
+    private static final MapList<ActionType, ActionListener> LISTENERS
86 86
             = new MapList<ActionType, ActionListener>();
87 87
 
88 88
     /** Indicates whether or not user actions should be killed (not processed). */
@@ -133,7 +133,7 @@ public final class ActionManager {
133 133
      * Saves all actions.
134 134
      */
135 135
     public static void saveActions() {
136
-        for (ActionGroup group : groups.values()) {
136
+        for (ActionGroup group : GROUPS.values()) {
137 137
             for (Action action : group) {
138 138
                 action.save();
139 139
             }
@@ -156,7 +156,7 @@ public final class ActionManager {
156 156
      * @param group The group of actions to be registered
157 157
      */
158 158
     public static void registerGroup(final ActionGroup group) {
159
-        groups.put(group.getName(), group);
159
+        GROUPS.put(group.getName(), group);
160 160
     }
161 161
 
162 162
     /**
@@ -169,9 +169,9 @@ public final class ActionManager {
169 169
         for (ActionType type : types) {
170 170
             Logger.assertTrue(type != null);
171 171
             
172
-            if(!actionTypes.contains(type)) {
173
-                actionTypes.add(type);
174
-                actionTypeGroups.add(type.getType().getGroup(), type);
172
+            if(!ACTION_TYPES.contains(type)) {
173
+                ACTION_TYPES.add(type);
174
+                ACTIONTYPE_GROUPS.add(type.getType().getGroup(), type);
175 175
             }
176 176
         }
177 177
     }
@@ -186,7 +186,7 @@ public final class ActionManager {
186 186
         for (ActionComponent comp : comps) {
187 187
             Logger.assertTrue(comp != null);
188 188
 
189
-            actionComponents.add(comp);
189
+            ACTION_COMPONENTS.add(comp);
190 190
         }
191 191
     }
192 192
 
@@ -200,7 +200,7 @@ public final class ActionManager {
200 200
         for (ActionComparison comp : comps) {
201 201
             Logger.assertTrue(comp != null);
202 202
 
203
-            actionComparisons.add(comp);
203
+            ACTION_COMPARISON.add(comp);
204 204
         }
205 205
     }
206 206
 
@@ -210,7 +210,7 @@ public final class ActionManager {
210 210
      * @return a map of groups to action lists
211 211
      */
212 212
     public static Map<String, ActionGroup> getGroups() {
213
-        return groups;
213
+        return GROUPS;
214 214
     }
215 215
 
216 216
     /**
@@ -219,16 +219,16 @@ public final class ActionManager {
219 219
      * @return A map of type groups to types
220 220
      */
221 221
     public static MapList<String, ActionType> getTypeGroups() {
222
-        return actionTypeGroups;
222
+        return ACTIONTYPE_GROUPS;
223 223
     }
224 224
 
225 225
     /**
226 226
      * Loads actions from the user's directory.
227 227
      */
228 228
     public static void loadActions() {
229
-        actions.clear();
229
+        ACTIONS.clear();
230 230
 
231
-        for (ActionGroup group : groups.values()) {
231
+        for (ActionGroup group : GROUPS.values()) {
232 232
             group.clear();
233 233
         }
234 234
 
@@ -261,7 +261,7 @@ public final class ActionManager {
261 261
      * Creates new ActionGroupComponents for each action group.
262 262
      */
263 263
     private static void registerComponents() {
264
-        for (ActionGroup group : groups.values()) {
264
+        for (ActionGroup group : GROUPS.values()) {
265 265
             new ActionGroupComponent(group);
266 266
         }
267 267
     }
@@ -276,8 +276,8 @@ public final class ActionManager {
276 276
         Logger.assertTrue(dir != null);
277 277
         Logger.assertTrue(dir.isDirectory());
278 278
         
279
-        if (!groups.containsKey(dir.getName())) {
280
-            groups.put(dir.getName(), new ActionGroup(dir.getName()));
279
+        if (!GROUPS.containsKey(dir.getName())) {
280
+            GROUPS.put(dir.getName(), new ActionGroup(dir.getName()));
281 281
         }
282 282
 
283 283
         for (File file : dir.listFiles()) {
@@ -295,7 +295,7 @@ public final class ActionManager {
295 295
         Logger.assertTrue(action != null);
296 296
  
297 297
         for (ActionType trigger : action.getTriggers()) {
298
-            actions.add(trigger, action);
298
+            ACTIONS.add(trigger, action);
299 299
         }
300 300
 
301 301
         getGroup(action.getGroup()).add(action);
@@ -309,11 +309,11 @@ public final class ActionManager {
309 309
      * @return The corresponding ActionGroup
310 310
      */
311 311
     public static ActionGroup getGroup(final String name) {
312
-        if (!groups.containsKey(name)) {
313
-            groups.put(name, new ActionGroup(name));
312
+        if (!GROUPS.containsKey(name)) {
313
+            GROUPS.put(name, new ActionGroup(name));
314 314
         }
315 315
 
316
-        return groups.get(name);
316
+        return GROUPS.get(name);
317 317
     }
318 318
 
319 319
     /**
@@ -325,7 +325,7 @@ public final class ActionManager {
325 325
     public static void unregisterAction(final Action action) {
326 326
         Logger.assertTrue(action != null);
327 327
 
328
-        actions.removeFromAll(action);
328
+        ACTIONS.removeFromAll(action);
329 329
         getGroup(action.getGroup()).remove(action);
330 330
     }
331 331
 
@@ -379,9 +379,9 @@ public final class ActionManager {
379 379
 
380 380
         boolean res = false;
381 381
 
382
-        if (listeners.containsKey(type)) {
382
+        if (LISTENERS.containsKey(type)) {
383 383
             for (ActionListener listener :
384
-                new ArrayList<ActionListener>(listeners.get(type))) {
384
+                new ArrayList<ActionListener>(LISTENERS.get(type))) {
385 385
                 try {
386 386
                     listener.processEvent(type, format, arguments);
387 387
                 } catch (Exception e) {
@@ -414,19 +414,19 @@ public final class ActionManager {
414 414
 
415 415
         boolean res = false;
416 416
 
417
-        if (actions.containsKey(type)) {
418
-            for (Action action : new ArrayList<Action>(actions.get(type))) {
417
+        if (ACTIONS.containsKey(type)) {
418
+            for (Action action : new ArrayList<Action>(ACTIONS.get(type))) {
419 419
                 try {
420 420
                     if (action.getConcurrencyGroup() == null) {
421 421
                         res |= action.trigger(format, arguments);
422 422
                     } else {
423
-                        synchronized (locks) {
424
-                            if (!locks.containsKey(action.getConcurrencyGroup())) {
425
-                                locks.put(action.getConcurrencyGroup(), new Object());
423
+                        synchronized (LOCKS) {
424
+                            if (!LOCKS.containsKey(action.getConcurrencyGroup())) {
425
+                                LOCKS.put(action.getConcurrencyGroup(), new Object());
426 426
                             }
427 427
                         }
428 428
 
429
-                        synchronized (locks.get(action.getConcurrencyGroup())) {
429
+                        synchronized (LOCKS.get(action.getConcurrencyGroup())) {
430 430
                             res |= action.trigger(format, arguments);
431 431
                         }
432 432
                     }
@@ -466,12 +466,12 @@ public final class ActionManager {
466 466
     public static ActionGroup makeGroup(final String group) {
467 467
         Logger.assertTrue(group != null);
468 468
         Logger.assertTrue(!group.isEmpty());
469
-        Logger.assertTrue(!groups.containsKey(group));
469
+        Logger.assertTrue(!GROUPS.containsKey(group));
470 470
 
471 471
         final File file = new File(getDirectory() + group);
472 472
         if (file.isDirectory() || file.mkdir()) {
473 473
             final ActionGroup actionGroup = new ActionGroup(group);
474
-            groups.put(group, actionGroup);
474
+            GROUPS.put(group, actionGroup);
475 475
             return actionGroup;
476 476
         } else {
477 477
             throw new IllegalArgumentException("Unable to create action group directory"
@@ -491,9 +491,9 @@ public final class ActionManager {
491 491
     public static void removeGroup(final String group) {
492 492
         Logger.assertTrue(group != null);
493 493
         Logger.assertTrue(!group.isEmpty());
494
-        Logger.assertTrue(groups.containsKey(group));
494
+        Logger.assertTrue(GROUPS.containsKey(group));
495 495
 
496
-        for (Action action : groups.get(group).getActions()) {
496
+        for (Action action : GROUPS.get(group).getActions()) {
497 497
             unregisterAction(action);
498 498
         }
499 499
 
@@ -515,7 +515,7 @@ public final class ActionManager {
515 515
             return;
516 516
         }
517 517
 
518
-        groups.remove(group);
518
+        GROUPS.remove(group);
519 519
     }
520 520
 
521 521
     /**
@@ -536,13 +536,13 @@ public final class ActionManager {
536 536
         Logger.assertTrue(!oldName.isEmpty());
537 537
         Logger.assertTrue(newName != null);
538 538
         Logger.assertTrue(!newName.isEmpty());
539
-        Logger.assertTrue(groups.containsKey(oldName));
540
-        Logger.assertTrue(!groups.containsKey(newName));
539
+        Logger.assertTrue(GROUPS.containsKey(oldName));
540
+        Logger.assertTrue(!GROUPS.containsKey(newName));
541 541
         Logger.assertTrue(!newName.equals(oldName));
542 542
 
543 543
         makeGroup(newName);
544 544
 
545
-        for (Action action : groups.get(oldName).getActions()) {
545
+        for (Action action : GROUPS.get(oldName).getActions()) {
546 546
             action.setGroup(newName);
547 547
             getGroup(oldName).remove(action);
548 548
             getGroup(newName).add(action);
@@ -563,7 +563,7 @@ public final class ActionManager {
563 563
             return null;
564 564
         }
565 565
 
566
-        for (ActionType target : actionTypes) {
566
+        for (ActionType target : ACTION_TYPES) {
567 567
             if (target.name().equals(type)) {
568 568
                 return target;
569 569
             }
@@ -584,7 +584,7 @@ public final class ActionManager {
584 584
         Logger.assertTrue(type != null);
585 585
 
586 586
         final List<ActionType> res = new ArrayList<ActionType>();
587
-        for (ActionType target : actionTypes) {
587
+        for (ActionType target : ACTION_TYPES) {
588 588
             if (!target.equals(type) && target.getType().equals(type.getType())) {
589 589
                 res.add(target);
590 590
             }
@@ -605,7 +605,7 @@ public final class ActionManager {
605 605
         Logger.assertTrue(target != null);
606 606
 
607 607
         final List<ActionComponent> res = new ArrayList<ActionComponent>();
608
-        for (ActionComponent subject : actionComponents) {
608
+        for (ActionComponent subject : ACTION_COMPONENTS) {
609 609
             if (subject.appliesTo().equals(target)) {
610 610
                 res.add(subject);
611 611
             }
@@ -626,7 +626,7 @@ public final class ActionManager {
626 626
         Logger.assertTrue(target != null);
627 627
 
628 628
         final List<ActionComparison> res = new ArrayList<ActionComparison>();
629
-        for (ActionComparison subject : actionComparisons) {
629
+        for (ActionComparison subject : ACTION_COMPARISON) {
630 630
             if (subject.appliesTo().equals(target)) {
631 631
                 res.add(subject);
632 632
             }
@@ -641,7 +641,7 @@ public final class ActionManager {
641 641
      * @return A list of registered action types
642 642
      */
643 643
     public static List<ActionType> getTypes() {
644
-        return actionTypes;
644
+        return ACTION_TYPES;
645 645
     }
646 646
 
647 647
     /**
@@ -650,7 +650,7 @@ public final class ActionManager {
650 650
      * @return A list of registered action comparisons
651 651
      */
652 652
     public static List<ActionComparison> getComparisons() {
653
-        return actionComparisons;
653
+        return ACTION_COMPARISON;
654 654
     }
655 655
 
656 656
     /**
@@ -665,7 +665,7 @@ public final class ActionManager {
665 665
         Logger.assertTrue(type != null);
666 666
         Logger.assertTrue(!type.isEmpty());
667 667
 
668
-        for (ActionComponent target : actionComponents) {
668
+        for (ActionComponent target : ACTION_COMPONENTS) {
669 669
             if (target.name().equals(type)) {
670 670
                 return target;
671 671
             }
@@ -686,7 +686,7 @@ public final class ActionManager {
686 686
         Logger.assertTrue(type != null);
687 687
         Logger.assertTrue(!type.isEmpty());
688 688
 
689
-        for (ActionComparison target : actionComparisons) {
689
+        for (ActionComparison target : ACTION_COMPARISON) {
690 690
             if (target.name().equals(type)) {
691 691
                 return target;
692 692
             }
@@ -719,7 +719,7 @@ public final class ActionManager {
719 719
      */
720 720
     public static void addListener(final ActionListener listener, final ActionType ... types) {
721 721
         for (ActionType type : types) {
722
-            listeners.add(type, listener);
722
+            LISTENERS.add(type, listener);
723 723
         }
724 724
     }
725 725
 
@@ -731,7 +731,7 @@ public final class ActionManager {
731 731
      */
732 732
     public static void removeListener(final ActionListener listener, final ActionType ... types) {
733 733
         for (ActionType type : types) {
734
-            listeners.remove(type, listener);
734
+            LISTENERS.remove(type, listener);
735 735
         }
736 736
     }
737 737
 
@@ -741,6 +741,6 @@ public final class ActionManager {
741 741
      * @param listener The listener to be removed
742 742
      */
743 743
     public static void removeListener(final ActionListener listener) {
744
-        listeners.removeFromAll(listener);
744
+        LISTENERS.removeFromAll(listener);
745 745
     }
746 746
 }

+ 0
- 1
src/com/dmdirc/actions/internal/WhoisNumericFormatter.java Visa fil

@@ -27,7 +27,6 @@ import com.dmdirc.actions.ActionManager;
27 27
 import com.dmdirc.actions.CoreActionType;
28 28
 import com.dmdirc.actions.interfaces.ActionType;
29 29
 import com.dmdirc.config.Identity;
30
-import com.dmdirc.config.IdentityManager;
31 30
 import com.dmdirc.interfaces.ActionListener;
32 31
 import java.util.HashMap;
33 32
 import java.util.Map;

+ 6
- 4
src/com/dmdirc/actions/wrappers/PerformWrapper.java Visa fil

@@ -167,10 +167,10 @@ public class PerformWrapper extends ActionGroup {
167 167
     }
168 168
     
169 169
     /** A singleton instance of the Perform Wrapper. */
170
-    private static PerformWrapper me = new PerformWrapper();
170
+    private static final PerformWrapper ME = new PerformWrapper();
171 171
 
172 172
     /** The component name for per-profile perform conditions. */
173
-    private static String PP_COMP_NAME = "SERVER_PROFILE.IDENTITY_NAME";
173
+    private static final String PP_COMP_NAME = "SERVER_PROFILE.IDENTITY_NAME";
174 174
     
175 175
     /**
176 176
      * Creates a new instance of PerformWrapper.
@@ -185,7 +185,7 @@ public class PerformWrapper extends ActionGroup {
185 185
      * @return A singleton instance of PerformWrapper
186 186
      */
187 187
     public static PerformWrapper getPerformWrapper() {
188
-        return me;
188
+        return ME;
189 189
     }
190 190
     
191 191
     /** {@inheritDoc} */
@@ -247,7 +247,9 @@ public class PerformWrapper extends ActionGroup {
247 247
                         perform.getProfile());
248 248
                 action.setResponse(content);
249 249
                 action.save();
250
-            } if (action != null) {
250
+            }
251
+
252
+            if (action != null) {
251 253
                 if (empty) {
252 254
                     // They want to clear the perform but we have an action
253 255
                     deleteAction(action);

+ 9
- 9
src/com/dmdirc/commandparser/CommandManager.java Visa fil

@@ -52,11 +52,11 @@ import java.util.Map;
52 52
 public final class CommandManager {
53 53
     
54 54
     /** A list of commands that have been instansiated. */
55
-    private static final Map<CommandInfo, Command> commands
55
+    private static final Map<CommandInfo, Command> COMMANDS
56 56
             = new HashMap<CommandInfo, Command>();
57 57
     
58 58
     /** A list of command parsers that have been instansiated. */
59
-    private static final MapList<CommandType, CommandParser> parsers
59
+    private static final MapList<CommandType, CommandParser> PARSERS
60 60
             = new MapList<CommandType, CommandParser>();
61 61
     
62 62
     /** The command char we're using. */
@@ -123,7 +123,7 @@ public final class CommandManager {
123 123
      * @since 0.6.3m1
124 124
      */
125 125
     public static void unregisterCommand(final CommandInfo info) {
126
-        registerCommand(info, commands.get(info), false);
126
+        registerCommand(info, COMMANDS.get(info), false);
127 127
     }
128 128
     
129 129
     /**
@@ -137,14 +137,14 @@ public final class CommandManager {
137 137
      */
138 138
     private static void registerCommand(final CommandInfo info, final Command command,
139 139
             final boolean register) {
140
-        if (parsers.containsKey(info.getType())) {
141
-            registerCommand(info, command, parsers.get(info.getType()), register);
140
+        if (PARSERS.containsKey(info.getType())) {
141
+            registerCommand(info, command, PARSERS.get(info.getType()), register);
142 142
         }
143 143
         
144 144
         if (register) {
145
-            commands.put(info, command);
145
+            COMMANDS.put(info, command);
146 146
         } else {
147
-            commands.remove(info);
147
+            COMMANDS.remove(info);
148 148
         }
149 149
 
150 150
         registerCommandName(info, register);
@@ -326,7 +326,7 @@ public final class CommandManager {
326 326
                     parser.registerCommand(pair.getValue(), pair.getKey());
327 327
                 }
328 328
 
329
-                parsers.add(type, parser);
329
+                PARSERS.add(type, parser);
330 330
             }
331 331
         }
332 332
     }
@@ -408,7 +408,7 @@ public final class CommandManager {
408 408
             final String name) {
409 409
         final Map<CommandInfo, Command> res = new HashMap<CommandInfo, Command>();
410 410
         
411
-        for (Map.Entry<CommandInfo, Command> entry : commands.entrySet()) {
411
+        for (Map.Entry<CommandInfo, Command> entry : COMMANDS.entrySet()) {
412 412
             if ((type == null || type.equals(entry.getKey().getType()))
413 413
                     && (name == null || name.equals(entry.getKey().getName()))) {
414 414
                 res.put(entry.getKey(), entry.getValue());

+ 1
- 1
src/com/dmdirc/config/CipherUtils.java Visa fil

@@ -63,7 +63,7 @@ public class CipherUtils {
63 63
     private Cipher dcipher;
64 64
     
65 65
     /** Salt. */
66
-    private final byte[] SALT = {
66
+    private static final byte[] SALT = {
67 67
         (byte) 0xA9, (byte) 0x9B, (byte) 0xC8, (byte) 0x32,
68 68
         (byte) 0x56, (byte) 0x35, (byte) 0xE3, (byte) 0x03,
69 69
     };

+ 3
- 3
src/com/dmdirc/config/ConfigManager.java Visa fil

@@ -44,7 +44,7 @@ public class ConfigManager extends ConfigSource implements ConfigChangeListener,
44 44
         IdentityListener {
45 45
 
46 46
     /** Temporary map for lookup stats. */
47
-    private static final Map<String, Integer> stats = new TreeMap<String, Integer>();
47
+    private static final Map<String, Integer> STATS = new TreeMap<String, Integer>();
48 48
 
49 49
     /** A logger for this class. */
50 50
     private static final java.util.logging.Logger LOGGER = java.util.logging
@@ -403,7 +403,7 @@ public class ConfigManager extends ConfigSource implements ConfigChangeListener,
403 403
         final String key = domain + "." + option;
404 404
 
405 405
         try {
406
-            stats.put(key, 1 + (stats.containsKey(key) ? stats.get(key) : 0));
406
+            STATS.put(key, 1 + (STATS.containsKey(key) ? STATS.get(key) : 0));
407 407
         } catch (NullPointerException ex) {
408 408
             // JVM bugs ftl.
409 409
         }
@@ -415,7 +415,7 @@ public class ConfigManager extends ConfigSource implements ConfigChangeListener,
415 415
      * @return A map of config options to lookup counts
416 416
      */
417 417
     public static Map<String, Integer> getStats() {
418
-        return stats;
418
+        return STATS;
419 419
     }
420 420
 
421 421
     /**

+ 28
- 28
src/com/dmdirc/config/IdentityManager.java Visa fil

@@ -57,7 +57,7 @@ public final class IdentityManager {
57 57
      * Standard identities are inserted with a <code>null</code> key, custom
58 58
      * identities use their custom type as the key.
59 59
      */
60
-    private static final MapList<String, Identity> identities
60
+    private static final MapList<String, Identity> IDENTITIES
61 61
             = new MapList<String, Identity>();
62 62
     
63 63
     /**
@@ -66,7 +66,7 @@ public final class IdentityManager {
66 66
      * Listeners for standard identities are inserted with a <code>null</code>
67 67
      * key, listeners for a specific custom type use their type as the key.
68 68
      */
69
-    private static final MapList<String, IdentityListener> listeners
69
+    private static final MapList<String, IdentityListener> LISTENERS
70 70
             = new WeakMapList<String, IdentityListener>();
71 71
 
72 72
     /** A logger for this class. */
@@ -96,8 +96,8 @@ public final class IdentityManager {
96 96
      *                                      file.
97 97
      */
98 98
     public static void load() throws InvalidIdentityFileException {
99
-        identities.clear();
100
-        identities.clear();
99
+        IDENTITIES.clear();
100
+        IDENTITIES.clear();
101 101
 
102 102
         loadVersion();
103 103
         loadDefaults();
@@ -269,7 +269,7 @@ public final class IdentityManager {
269 269
      * @param file The file to load the identity from.
270 270
      */
271 271
     private static void loadIdentity(final File file) {
272
-        synchronized (identities) {
272
+        synchronized (IDENTITIES) {
273 273
             for (Identity identity : getAllIdentities()) {
274 274
                 if (identity.isFile(file)) {
275 275
                     try {
@@ -309,7 +309,7 @@ public final class IdentityManager {
309 309
     private static Set<Identity> getAllIdentities() {
310 310
         final Set<Identity> res = new LinkedHashSet<Identity>();
311 311
 
312
-        for (Map.Entry<String, List<Identity>> entry : identities.entrySet()) {
312
+        for (Map.Entry<String, List<Identity>> entry : IDENTITIES.entrySet()) {
313 313
             res.addAll(entry.getValue());
314 314
         }
315 315
 
@@ -398,7 +398,7 @@ public final class IdentityManager {
398 398
      * Saves all modified identity files to disk.
399 399
      */
400 400
     public static void save() {
401
-        synchronized (identities) {
401
+        synchronized (IDENTITIES) {
402 402
             for (Identity identity : getAllIdentities()) {
403 403
                 identity.save();
404 404
             }
@@ -415,18 +415,18 @@ public final class IdentityManager {
415 415
 
416 416
         final String target = getGroup(identity);
417 417
 
418
-        if (identities.containsValue(target, identity)) {
418
+        if (IDENTITIES.containsValue(target, identity)) {
419 419
             removeIdentity(identity);
420 420
         }
421 421
 
422
-        synchronized (identities) {
423
-            identities.add(target, identity);
422
+        synchronized (IDENTITIES) {
423
+            IDENTITIES.add(target, identity);
424 424
         }
425 425
 
426 426
         LOGGER.finer("Adding identity: " + identity + " (group: " + target + ")");
427 427
 
428
-        synchronized (listeners) {
429
-            for (IdentityListener listener : listeners.safeGet(target)) {
428
+        synchronized (LISTENERS) {
429
+            for (IdentityListener listener : LISTENERS.safeGet(target)) {
430 430
                 listener.identityAdded(identity);
431 431
             }
432 432
         }
@@ -445,14 +445,14 @@ public final class IdentityManager {
445 445
 
446 446
         final String group = getGroup(identity);
447 447
 
448
-        Logger.assertTrue(identities.containsValue(group, identity));
448
+        Logger.assertTrue(IDENTITIES.containsValue(group, identity));
449 449
         
450
-        synchronized (identities) {
451
-            identities.remove(group, identity);
450
+        synchronized (IDENTITIES) {
451
+            IDENTITIES.remove(group, identity);
452 452
         }
453 453
         
454
-        synchronized (listeners) {
455
-            for (IdentityListener listener : listeners.safeGet(group)) {
454
+        synchronized (LISTENERS) {
455
+            for (IdentityListener listener : LISTENERS.safeGet(group)) {
456 456
                 listener.identityRemoved(identity);
457 457
             }
458 458
         }
@@ -494,8 +494,8 @@ public final class IdentityManager {
494 494
     public static void addIdentityListener(final String type, final IdentityListener listener) {
495 495
         Logger.assertTrue(listener != null);
496 496
         
497
-        synchronized (listeners) {
498
-            listeners.add(type, listener);
497
+        synchronized (LISTENERS) {
498
+            LISTENERS.add(type, listener);
499 499
         }
500 500
     }
501 501
     
@@ -519,7 +519,7 @@ public final class IdentityManager {
519 519
      * @since 0.6.4
520 520
      */
521 521
     public static List<Identity> getCustomIdentities(final String type) {
522
-        return Collections.unmodifiableList(identities.safeGet(type));
522
+        return Collections.unmodifiableList(IDENTITIES.safeGet(type));
523 523
     }
524 524
     
525 525
     /**
@@ -533,8 +533,8 @@ public final class IdentityManager {
533 533
         
534 534
         final List<Identity> sources = new ArrayList<Identity>();
535 535
         
536
-        synchronized (identities) {
537
-            for (Identity identity : identities.safeGet(null)) {
536
+        synchronized (IDENTITIES) {
537
+            for (Identity identity : IDENTITIES.safeGet(null)) {
538 538
                 if (manager.identityApplies(identity)) {
539 539
                     sources.add(identity);
540 540
                 }
@@ -584,8 +584,8 @@ public final class IdentityManager {
584 584
 
585 585
         final String myTarget = (channel + "@" + network).toLowerCase();
586 586
         
587
-        synchronized (identities) {
588
-            for (Identity identity : identities.safeGet(null)) {
587
+        synchronized (IDENTITIES) {
588
+            for (Identity identity : IDENTITIES.safeGet(null)) {
589 589
                 if (identity.getTarget().getType() == ConfigTarget.TYPE.CHANNEL
590 590
                         && identity.getTarget().getData().equalsIgnoreCase(myTarget)) {
591 591
                     return identity;
@@ -621,8 +621,8 @@ public final class IdentityManager {
621 621
 
622 622
         final String myTarget = network.toLowerCase();
623 623
         
624
-        synchronized (identities) {
625
-            for (Identity identity : identities.safeGet(null)) {
624
+        synchronized (IDENTITIES) {
625
+            for (Identity identity : IDENTITIES.safeGet(null)) {
626 626
                 if (identity.getTarget().getType() == ConfigTarget.TYPE.NETWORK
627 627
                         && identity.getTarget().getData().equalsIgnoreCase(myTarget)) {
628 628
                     return identity;
@@ -658,8 +658,8 @@ public final class IdentityManager {
658 658
         
659 659
         final String myTarget = server.toLowerCase();
660 660
         
661
-        synchronized (identities) {
662
-            for (Identity identity : identities.safeGet(null)) {
661
+        synchronized (IDENTITIES) {
662
+            for (Identity identity : IDENTITIES.safeGet(null)) {
663 663
                 if (identity.getTarget().getType() == ConfigTarget.TYPE.SERVER
664 664
                         && identity.getTarget().getData().equalsIgnoreCase(myTarget)) {
665 665
                     return identity;

+ 5
- 5
src/com/dmdirc/installer/Settings.java Visa fil

@@ -32,33 +32,33 @@ public interface Settings {
32 32
      *
33 33
      * @return shortcutMenu checkbox state
34 34
      */
35
-    public boolean getShortcutMenuState();
35
+    boolean getShortcutMenuState();
36 36
 
37 37
     /**
38 38
      * Returns the state of the shortcutDesktop checkbox.
39 39
      *
40 40
      * @return shortcutDesktop checkbox state
41 41
      */
42
-    public boolean getShortcutDesktopState();
42
+    boolean getShortcutDesktopState();
43 43
 
44 44
     /**
45 45
      * Returns the state of the shortcutDesktop checkbox.
46 46
      *
47 47
      * @return shortcutDesktop checkbox state
48 48
      */
49
-    public boolean getShortcutQuickState();
49
+    boolean getShortcutQuickState();
50 50
 
51 51
     /**
52 52
      * Returns the state of the shortcutProtocol checkbox.
53 53
      *
54 54
      * @return shortcutDesktop checkbox state
55 55
      */
56
-    public boolean getShortcutProtocolState();
56
+    boolean getShortcutProtocolState();
57 57
 
58 58
     /**
59 59
      * Returns the location chosen for installation.
60 60
      *
61 61
      * @return location chosen for installation.
62 62
      */
63
-    public String getInstallLocation();
63
+    String getInstallLocation();
64 64
 }

+ 3
- 3
src/com/dmdirc/installer/Step.java Visa fil

@@ -35,19 +35,19 @@ public interface Step {
35 35
      * 
36 36
      * @return Step name
37 37
      */
38
-    public abstract String getStepName();
38
+    String getStepName();
39 39
     
40 40
     /**
41 41
      * Returns the description for this step.
42 42
      * 
43 43
      * @return Step description
44 44
      */
45
-    public abstract String getStepDescription();
45
+    String getStepDescription();
46 46
     
47 47
     /**
48 48
      * Returns the icon for this step.
49 49
      * 
50 50
      * @return Step icon
51 51
      */
52
-    public abstract Image getIcon();
52
+    Image getIcon();
53 53
 }

+ 15
- 13
src/com/dmdirc/installer/TextStep.java Visa fil

@@ -26,17 +26,19 @@ package com.dmdirc.installer;
26 26
  * Quick access methods for a step to have a controllable text field.
27 27
  */
28 28
 public interface TextStep {
29
-	/**
30
-	 * Add text to the infolabel on this step
31
-	 *
32
-	 * @param text Text to add to infoLabel
33
-	 */
34
-	public void addText(final String text);
35
-	
36
-	/**
37
-	 * Sets the text in the infolabel on this step
38
-	 *
39
-	 * @param text Text to set the infoLabel to
40
-	 */
41
-	public void setText(final String text);
29
+
30
+    /**
31
+     * Add text to the infolabel on this step
32
+     *
33
+     * @param text Text to add to infoLabel
34
+     */
35
+    void addText(final String text);
36
+
37
+    /**
38
+     * Sets the text in the infolabel on this step
39
+     *
40
+     * @param text Text to set the infoLabel to
41
+     */
42
+    void setText(final String text);
43
+
42 44
 }

+ 1
- 1
src/com/dmdirc/installer/WindowsInstaller.java Visa fil

@@ -186,7 +186,7 @@ public class WindowsInstaller extends Installer {
186 186
      *            Command array to execute/
187 187
      * @return return value from command, or -1 if there was an error.
188 188
      */
189
-    private int execAndWait(final String cmd[]) {
189
+    private int execAndWait(final String[] cmd) {
190 190
         try {
191 191
             final Process myProcess = Runtime.getRuntime().exec(cmd);
192 192
             new StreamReader(myProcess.getInputStream()).start();

+ 62
- 61
src/com/dmdirc/installer/cliparser/CLIParam.java Visa fil

@@ -26,65 +26,66 @@ package com.dmdirc.installer.cliparser;
26 26
  * Command Line argument type.
27 27
  */
28 28
 public abstract class CLIParam {
29
-	/** Single Character flag for this param. */
30
-	private final char charFlag;
31
-	/** String flag for this param. */
32
-	private final String stringFlag;
33
-	/** Description of this flag. */
34
-	private final String description;
35
-	/** Number of times this param has been given. */
36
-	private int number;
37
-	
38
-	/**
39
-	 * Create a new CLIParam.
40
-	 *
41
-	 * @param chr Single Character flag for this param.
42
-	 * @param str String flag for this param.
43
-	 * @param desc Description of this flag.
44
-	 */
45
-	protected CLIParam(final char chr, final String str, final String desc) {
46
-		charFlag = chr;
47
-		stringFlag = str;
48
-		description = desc;
49
-	}
50
-	
51
-	/**
52
-	 * Get the single character flag for this param.
53
-	 */
54
-	public final char getChr() { return charFlag; }
55
-	
56
-	/**
57
-	 * Get the string flag for this param.
58
-	 */
59
-	public final String getString() { return stringFlag; }
60
-	
61
-	/**
62
-	 * Get the description for this param.
63
-	 */
64
-	public final String getDescription() { return description; }
65
-	
66
-	/**
67
-	 * Get the number of times this value has been given.
68
-	 */
69
-	public final int getNumber() { return number; }
70
-	
71
-	/**
72
-	 * Increment the number of times this value has been given.
73
-	 */
74
-	public final void incNumber() { ++number; }
75
-	
76
-	/**
77
-	 * Set the value of this param to the value given by a string.
78
-	 *
79
-	 * @param value String taken from command line to use as value.
80
-	 * @return true if value was valid, else false.
81
-	 */
82
-	public abstract boolean setValue(final String value);
83
-	
84
-	/**
85
-	 * Return the value of this param as a string.
86
-	 *
87
-	 * @return The value of this param as a string.
88
-	 */
89
-	public abstract String getStringValue();
29
+
30
+    /** Single Character flag for this param. */
31
+    private final char charFlag;
32
+    /** String flag for this param. */
33
+    private final String stringFlag;
34
+    /** Description of this flag. */
35
+    private final String description;
36
+    /** Number of times this param has been given. */
37
+    private int number;
38
+
39
+    /**
40
+     * Create a new CLIParam.
41
+     *
42
+     * @param chr Single Character flag for this param.
43
+     * @param str String flag for this param.
44
+     * @param desc Description of this flag.
45
+     */
46
+    protected CLIParam(final char chr, final String str, final String desc) {
47
+        charFlag = chr;
48
+        stringFlag = str;
49
+        description = desc;
50
+    }
51
+
52
+    /**
53
+     * Get the single character flag for this param.
54
+     */
55
+    public final char getChr() { return charFlag; }
56
+
57
+    /**
58
+     * Get the string flag for this param.
59
+     */
60
+    public final String getString() { return stringFlag; }
61
+
62
+    /**
63
+     * Get the description for this param.
64
+     */
65
+    public final String getDescription() { return description; }
66
+
67
+    /**
68
+     * Get the number of times this value has been given.
69
+     */
70
+    public final int getNumber() { return number; }
71
+
72
+    /**
73
+     * Increment the number of times this value has been given.
74
+     */
75
+    public final void incNumber() { ++number; }
76
+
77
+    /**
78
+     * Set the value of this param to the value given by a string.
79
+     *
80
+     * @param value String taken from command line to use as value.
81
+     * @return true if value was valid, else false.
82
+     */
83
+    public abstract boolean setValue(final String value);
84
+
85
+    /**
86
+     * Return the value of this param as a string.
87
+     *
88
+     * @return The value of this param as a string.
89
+     */
90
+    public abstract String getStringValue();
90 91
 }

+ 1
- 1
src/com/dmdirc/installer/cliparser/CLIParser.java Visa fil

@@ -87,7 +87,7 @@ public class CLIParser {
87 87
      */
88 88
     public boolean add(final CLIParam param) {
89 89
         final boolean validChar = param.getChr() == 0
90
-                || !params.containsKey(param.getChr());
90
+                || !params.containsKey(String.valueOf(param.getChr()));
91 91
         final boolean validString = param.getString().isEmpty()
92 92
                 || !params.containsKey("-" + param.getString());
93 93
         if (validChar && validString) {

+ 43
- 42
src/com/dmdirc/installer/cliparser/StringParam.java Visa fil

@@ -26,46 +26,47 @@ package com.dmdirc.installer.cliparser;
26 26
  * Command Line argument type.
27 27
  */
28 28
 public class StringParam extends CLIParam {
29
-	/** The value of this param. */
30
-	private String myValue = "";
31
-	
32
-	/**
33
-	 * Create a new StringParam.
34
-	 *
35
-	 * @param chr Single Character flag for this param.
36
-	 * @param str String flag for this param.
37
-	 * @param desc Description of this flag.
38
-	 */
39
-	public StringParam(final char chr, final String str, final String desc) {
40
-		super(chr, str, desc);
41
-	}
42
-	
43
-	/**
44
-	 * Set the value of this param to the value given by a string.
45
-	 *
46
-	 * @param value String taken from command line to use as value.
47
-	 * @return true if value was valid, else false.
48
-	 */
49
-	public boolean setValue(final String value) {
50
-		myValue = value;
51
-		return true;
52
-	}
53
-	
54
-	/**
55
-	 * Get the value of this param.
56
-	 *
57
-	 * @return Value of this parameter
58
-	 */
59
-	public String getValue() {
60
-		return myValue;
61
-	}
62
-	
63
-	/**
64
-	 * Return the value of this param as a string.
65
-	 *
66
-	 * @return The value of this param as a string.
67
-	 */
68
-	public String getStringValue() {
69
-		return getValue();
70
-	}
29
+
30
+    /** The value of this param. */
31
+    private String myValue = "";
32
+
33
+    /**
34
+    * Create a new StringParam.
35
+    *
36
+    * @param chr Single Character flag for this param.
37
+    * @param str String flag for this param.
38
+    * @param desc Description of this flag.
39
+    */
40
+    public StringParam(final char chr, final String str, final String desc) {
41
+        super(chr, str, desc);
42
+    }
43
+
44
+    /**
45
+    * Set the value of this param to the value given by a string.
46
+    *
47
+    * @param value String taken from command line to use as value.
48
+    * @return true if value was valid, else false.
49
+    */
50
+    public boolean setValue(final String value) {
51
+        myValue = value;
52
+        return true;
53
+    }
54
+
55
+    /**
56
+    * Get the value of this param.
57
+    *
58
+    * @return Value of this parameter
59
+    */
60
+    public String getValue() {
61
+        return myValue;
62
+    }
63
+
64
+    /**
65
+    * Return the value of this param as a string.
66
+    *
67
+    * @return The value of this param as a string.
68
+    */
69
+    public String getStringValue() {
70
+        return getValue();
71
+    }
71 72
 }

+ 10
- 10
src/com/dmdirc/installer/ui/StepSettings.java Visa fil

@@ -76,24 +76,24 @@ public final class StepSettings extends SwingStep implements Settings {
76 76
         shortcutProtocol.setSelected(defaultSettings.getShortcutProtocolState());
77 77
 
78 78
         final GridBagConstraints constraints = new GridBagConstraints();
79
-		setLayout(new GridBagLayout());
79
+        setLayout(new GridBagLayout());
80 80
 
81 81
         constraints.weightx = 1.0;
82
-		constraints.fill = GridBagConstraints.BOTH;
83
-		constraints.gridx = 0;
84
-		constraints.gridy = 0;
85
-		constraints.gridwidth = 2;
82
+        constraints.fill = GridBagConstraints.BOTH;
83
+        constraints.gridx = 0;
84
+        constraints.gridy = 0;
85
+        constraints.gridwidth = 2;
86 86
         add(new TextLabel("Here you can choose options for the install." +
87 87
                           "\n\nInstall Location:"), constraints);
88 88
 
89 89
         constraints.fill = GridBagConstraints.HORIZONTAL;
90
-		constraints.gridx = 1;
90
+        constraints.gridx = 1;
91 91
         constraints.gridy = 1;
92 92
         add(location, constraints);
93 93
 
94 94
         constraints.gridwidth = 2;
95
-		constraints.gridx = 0;
96
-		constraints.insets = new Insets(InstallerDialog.SMALL_GAP, 0, 0, 0);
95
+        constraints.gridx = 0;
96
+        constraints.insets = new Insets(InstallerDialog.SMALL_GAP, 0, 0, 0);
97 97
 
98 98
         if (Main.getInstaller().supportsShortcut(ShortcutType.MENU)) {
99 99
             constraints.gridy = (constraints.gridy + 1);
@@ -113,8 +113,8 @@ public final class StepSettings extends SwingStep implements Settings {
113 113
         }
114 114
 
115 115
         constraints.gridy = (constraints.gridy + 1);
116
-		constraints.weighty = 1.0;
117
-		constraints.fill = GridBagConstraints.BOTH;
116
+        constraints.weighty = 1.0;
117
+        constraints.fill = GridBagConstraints.BOTH;
118 118
         add(Box.createVerticalGlue(), constraints);
119 119
     }
120 120
 

+ 3
- 3
src/com/dmdirc/logger/ErrorManager.java Visa fil

@@ -42,7 +42,7 @@ import java.util.concurrent.atomic.AtomicLong;
42 42
 public final class ErrorManager implements ConfigChangeListener {
43 43
 
44 44
     /** Previously instantiated instance of ErrorManager. */
45
-    private static final ErrorManager me = new ErrorManager();
45
+    private static final ErrorManager ME = new ErrorManager();
46 46
 
47 47
     /** A list of exceptions which we don't consider bugs and thus don't report. */
48 48
     private static final Class[] BANNED_EXCEPTIONS = new Class[]{
@@ -92,8 +92,8 @@ public final class ErrorManager implements ConfigChangeListener {
92 92
      * @return Instance of ErrorManager
93 93
      */
94 94
     public static ErrorManager getErrorManager() {
95
-        synchronized (me) {
96
-            return me;
95
+        synchronized (ME) {
96
+            return ME;
97 97
         }
98 98
     }
99 99
 

+ 6
- 6
src/com/dmdirc/logger/Logger.java Visa fil

@@ -27,8 +27,8 @@ package com.dmdirc.logger;
27 27
  */
28 28
 public final class Logger {
29 29
 
30
-    /** The manager to use to report errors. */
31
-    protected static final ErrorManager manager = ErrorManager.getErrorManager();
30
+    /** The MANAGER to use to report errors. */
31
+    protected static final ErrorManager MANAGER = ErrorManager.getErrorManager();
32 32
        
33 33
     /** Prevent instantiation of a new instance of Logger. */
34 34
     private Logger() {
@@ -42,7 +42,7 @@ public final class Logger {
42 42
      * @param message Brief error description
43 43
      */
44 44
     public static void userError(final ErrorLevel level, final String message) {
45
-        manager.addError(level, message);
45
+        MANAGER.addError(level, message);
46 46
     }
47 47
     
48 48
     /**
@@ -54,7 +54,7 @@ public final class Logger {
54 54
      */
55 55
     public static void userError(final ErrorLevel level, final String message,
56 56
             final String details) {
57
-        manager.addError(level, message, new String[]{details}, false);
57
+        MANAGER.addError(level, message, new String[]{details}, false);
58 58
     }
59 59
     
60 60
     /**
@@ -66,7 +66,7 @@ public final class Logger {
66 66
      */
67 67
     public static void userError(final ErrorLevel level,
68 68
             final String message, final Throwable exception) {
69
-        manager.addError(level, message, exception, false);
69
+        MANAGER.addError(level, message, exception, false);
70 70
     }
71 71
     
72 72
     /**
@@ -79,7 +79,7 @@ public final class Logger {
79 79
      */
80 80
     public static void appError(final ErrorLevel level,
81 81
             final String message, final Throwable exception) {
82
-        manager.addError(level, message, exception, true);
82
+        MANAGER.addError(level, message, exception, true);
83 83
     }
84 84
     
85 85
     /**

+ 3
- 3
src/com/dmdirc/logger/ProgramError.java Visa fil

@@ -60,7 +60,7 @@ public final class ProgramError implements Serializable {
60 60
     private static File errorDir;
61 61
 
62 62
     /** Semaphore used to serialise write access. */
63
-    private static final Semaphore writingSem = new Semaphore(1);
63
+    private static final Semaphore WRITING_SEM = new Semaphore(1);
64 64
     
65 65
     /** Error ID. */
66 66
     private final long id;
@@ -269,7 +269,7 @@ public final class ProgramError implements Serializable {
269 269
      */
270 270
     @SuppressWarnings("PMD.SystemPrintln")
271 271
     private OutputStream getErrorFile() {
272
-        writingSem.acquireUninterruptibly();
272
+        WRITING_SEM.acquireUninterruptibly();
273 273
         
274 274
         if (errorDir == null || !errorDir.exists()) {
275 275
             errorDir = new File(Main.getConfigDir() + "errors");
@@ -299,7 +299,7 @@ public final class ProgramError implements Serializable {
299 299
             ex.printStackTrace();
300 300
             return new NullOutputStream();
301 301
         } finally {
302
-            writingSem.release();
302
+            WRITING_SEM.release();
303 303
         }
304 304
     }
305 305
 

+ 1
- 1
src/com/dmdirc/plugins/GlobalClassLoader.java Visa fil

@@ -64,7 +64,7 @@ public final class GlobalClassLoader extends ClassLoader {
64 64
      *
65 65
      * @return A singleton instance of GlobalClassLoader.
66 66
      */
67
-    public static final synchronized GlobalClassLoader getGlobalClassLoader() {
67
+    public static synchronized GlobalClassLoader getGlobalClassLoader() {
68 68
         if (me == null) {
69 69
             me = new GlobalClassLoader();
70 70
         }

+ 1
- 1
src/com/dmdirc/plugins/PluginManager.java Visa fil

@@ -321,7 +321,7 @@ public class PluginManager implements ActionListener {
321 321
             return false;
322 322
         }
323 323
 
324
-	final PluginInfo pluginInfo = getPluginInfo(filename);
324
+        final PluginInfo pluginInfo = getPluginInfo(filename);
325 325
         final boolean wasLoaded = pluginInfo.isLoaded();
326 326
 
327 327
         if (wasLoaded && !pluginInfo.isUnloadable()) { return false; }

+ 26
- 26
src/com/dmdirc/ui/WindowManager.java Visa fil

@@ -48,19 +48,19 @@ import java.util.concurrent.CopyOnWriteArrayList;
48 48
 public class WindowManager {
49 49
 
50 50
     /** A list of root windows. */
51
-    private final static List<FrameContainer<?>> rootWindows
51
+    private static final List<FrameContainer<?>> ROOT_WINDOWS
52 52
             = new CopyOnWriteArrayList<FrameContainer<?>>();
53 53
     
54 54
     /** A list of frame listeners. */
55
-    private final static List<FrameListener> frameListeners
55
+    private static final List<FrameListener> FRAME_LISTENERS
56 56
             = new ArrayList<FrameListener>();
57 57
     
58 58
     /** A list of selection listeners. */
59
-    private final static List<SelectionListener> selListeners
59
+    private static final List<SelectionListener> SELECTION_LISTENERS
60 60
             = new ArrayList<SelectionListener>();
61 61
     
62 62
     /** Our selection listener proxy. */
63
-    private static final SelectionListener selectionListener
63
+    private static final SelectionListener SELECTION_LISTENER
64 64
             = new WMSelectionListener();
65 65
 
66 66
     /** Active window. */
@@ -84,9 +84,9 @@ public class WindowManager {
84 84
     })
85 85
     public static void addFrameListener(final FrameListener frameListener) {
86 86
         Logger.assertTrue(frameListener != null);
87
-        Logger.assertTrue(!frameListeners.contains(frameListener));
87
+        Logger.assertTrue(!FRAME_LISTENERS.contains(frameListener));
88 88
 
89
-        frameListeners.add(frameListener);
89
+        FRAME_LISTENERS.add(frameListener);
90 90
     }
91 91
 
92 92
     /**
@@ -100,9 +100,9 @@ public class WindowManager {
100 100
     })
101 101
     public static void removeFrameListener(final FrameListener frameListener) {
102 102
         Logger.assertTrue(frameListener != null);
103
-        Logger.assertTrue(frameListeners.contains(frameListener));
103
+        Logger.assertTrue(FRAME_LISTENERS.contains(frameListener));
104 104
 
105
-        frameListeners.remove(frameListener);
105
+        FRAME_LISTENERS.remove(frameListener);
106 106
     }
107 107
     
108 108
     /**
@@ -111,7 +111,7 @@ public class WindowManager {
111 111
      * @param listener The listener to be added
112 112
      */
113 113
     public static void addSelectionListener(final SelectionListener listener) {
114
-        selListeners.add(listener);
114
+        SELECTION_LISTENERS.add(listener);
115 115
     }
116 116
     
117 117
     /**
@@ -120,7 +120,7 @@ public class WindowManager {
120 120
      * @param listener The listener to be removed
121 121
      */
122 122
     public static void removeSelectionListener(final SelectionListener listener) {
123
-        selListeners.remove(listener);
123
+        SELECTION_LISTENERS.remove(listener);
124 124
     }
125 125
 
126 126
     /**
@@ -150,11 +150,11 @@ public class WindowManager {
150 150
     })
151 151
     public static void addWindow(final FrameContainer<?> window, final boolean focus) {
152 152
         Logger.assertTrue(window != null);
153
-        Logger.assertTrue(!rootWindows.contains(window));
153
+        Logger.assertTrue(!ROOT_WINDOWS.contains(window));
154 154
 
155
-        rootWindows.add(window);
155
+        ROOT_WINDOWS.add(window);
156 156
 
157
-        window.addSelectionListener(selectionListener);
157
+        window.addSelectionListener(SELECTION_LISTENER);
158 158
 
159 159
         fireAddWindow(window, focus);
160 160
     }
@@ -224,7 +224,7 @@ public class WindowManager {
224 224
 
225 225
         parent.addChild(child);
226 226
 
227
-        child.addSelectionListener(selectionListener);
227
+        child.addSelectionListener(SELECTION_LISTENER);
228 228
 
229 229
         fireAddWindow(parent, child, focus);
230 230
     }
@@ -239,7 +239,7 @@ public class WindowManager {
239 239
      * @return True if the target is in the hierarchy, false otherise
240 240
      */
241 241
     protected static boolean isInHierarchy(final FrameContainer<?> target) {
242
-        return target != null && (rootWindows.contains(target)
242
+        return target != null && (ROOT_WINDOWS.contains(target)
243 243
                 || isInHierarchy(target.getParent()));
244 244
     }
245 245
 
@@ -330,11 +330,11 @@ public class WindowManager {
330 330
             }
331 331
         }
332 332
 
333
-        if (rootWindows.contains(window)) {
333
+        if (ROOT_WINDOWS.contains(window)) {
334 334
             fireDeleteWindow(window);
335
-            rootWindows.remove(window);
335
+            ROOT_WINDOWS.remove(window);
336 336
 
337
-            if (rootWindows.isEmpty()) {
337
+            if (ROOT_WINDOWS.isEmpty()) {
338 338
                 // Last root window has been removed, show that the selected
339 339
                 // window is now null
340 340
                 fireSelectionChanged(null);
@@ -354,7 +354,7 @@ public class WindowManager {
354 354
             }
355 355
         }
356 356
         
357
-        window.removeSelectionListener(selectionListener);
357
+        window.removeSelectionListener(SELECTION_LISTENER);
358 358
         window.windowClosed();
359 359
     }
360 360
 
@@ -369,7 +369,7 @@ public class WindowManager {
369 369
     public static FrameContainer<?> findCustomWindow(final String name) {
370 370
         Logger.assertTrue(name != null);
371 371
 
372
-        return findCustomWindow(rootWindows, name);
372
+        return findCustomWindow(ROOT_WINDOWS, name);
373 373
     }
374 374
 
375 375
     /**
@@ -434,7 +434,7 @@ public class WindowManager {
434 434
      * @return A collection of all known root windows.
435 435
      */
436 436
     public static Collection<FrameContainer<?>> getRootWindows() {
437
-        return rootWindows;
437
+        return ROOT_WINDOWS;
438 438
     }
439 439
 
440 440
     /**
@@ -477,7 +477,7 @@ public class WindowManager {
477 477
      * @param focus Should this window become focused
478 478
      */
479 479
     private static void fireAddWindow(final FrameContainer<?> window, final boolean focus) {
480
-        for (FrameListener listener : frameListeners) {
480
+        for (FrameListener listener : FRAME_LISTENERS) {
481 481
             listener.addWindow(window, focus);
482 482
         }
483 483
     }
@@ -492,7 +492,7 @@ public class WindowManager {
492 492
      */
493 493
     private static void fireAddWindow(final FrameContainer<?> parent,
494 494
             final FrameContainer<?> child, final boolean focus) {
495
-        for (FrameListener listener : frameListeners) {
495
+        for (FrameListener listener : FRAME_LISTENERS) {
496 496
             listener.addWindow(parent, child, focus);
497 497
         }
498 498
     }
@@ -503,7 +503,7 @@ public class WindowManager {
503 503
      * @param window The window that was removed
504 504
      */
505 505
     private static void fireDeleteWindow(final FrameContainer<?> window) {
506
-        for (FrameListener listener : frameListeners) {
506
+        for (FrameListener listener : FRAME_LISTENERS) {
507 507
             listener.delWindow(window);
508 508
         }
509 509
     }
@@ -516,7 +516,7 @@ public class WindowManager {
516 516
      */
517 517
     private static void fireDeleteWindow(final FrameContainer<?> parent,
518 518
             final FrameContainer<?> child) {
519
-        for (FrameListener listener : frameListeners) {
519
+        for (FrameListener listener : FRAME_LISTENERS) {
520 520
             listener.delWindow(parent, child);
521 521
         }
522 522
     }
@@ -528,7 +528,7 @@ public class WindowManager {
528 528
      * @param window The window that is now focused (or null)
529 529
      */
530 530
     private static void fireSelectionChanged(final FrameContainer<?> window) {
531
-        for (SelectionListener listener : selListeners) {
531
+        for (SelectionListener listener : SELECTION_LISTENERS) {
532 532
             listener.selectionChanged(window);
533 533
         }
534 534
 

+ 3
- 3
src/com/dmdirc/ui/core/util/URLHandler.java Visa fil

@@ -44,7 +44,7 @@ public class URLHandler {
44 44
     /** Config manager. */
45 45
     private final ConfigManager config;
46 46
     /** Singleton instance. */
47
-    private static final URLHandler me = new URLHandler();
47
+    private static final URLHandler ME = new URLHandler();
48 48
     /** Desktop handler. */
49 49
     private final Desktop desktop;
50 50
     /** The time a browser was last launched. */
@@ -66,8 +66,8 @@ public class URLHandler {
66 66
      * @return URLHandler instance
67 67
      */
68 68
     public static URLHandler getURLHander() {
69
-        synchronized (me) {
70
-            return me;
69
+        synchronized (ME) {
70
+            return ME;
71 71
         }
72 72
     }
73 73
 

+ 0
- 1
src/com/dmdirc/ui/interfaces/InputWindow.java Visa fil

@@ -24,7 +24,6 @@ package com.dmdirc.ui.interfaces;
24 24
 
25 25
 import com.dmdirc.WritableFrameContainer;
26 26
 import com.dmdirc.commandparser.parsers.CommandParser;
27
-import com.dmdirc.interfaces.AwayStateListener;
28 27
 import com.dmdirc.ui.input.InputHandler;
29 28
 
30 29
 /**

+ 2
- 2
src/com/dmdirc/ui/interfaces/SearchBar.java Visa fil

@@ -66,7 +66,7 @@ public interface SearchBar {
66 66
      * @param text the text to search for
67 67
      * @param caseSensitive whether the search is case sensitive
68 68
      */
69
-    public void search(final String text, final boolean caseSensitive);
69
+    void search(final String text, final boolean caseSensitive);
70 70
 
71 71
     /**
72 72
      * Searches the textpane for text.
@@ -75,6 +75,6 @@ public interface SearchBar {
75 75
      * @param text the text to search for
76 76
      * @param caseSensitive whether the search is case sensitive
77 77
      */
78
-    public void search(final Direction direction, final String text,
78
+    void search(final Direction direction, final String text,
79 79
             final boolean caseSensitive);
80 80
 }

+ 0
- 1
src/com/dmdirc/ui/interfaces/UIController.java Visa fil

@@ -28,7 +28,6 @@ import com.dmdirc.Query;
28 28
 import com.dmdirc.Server;
29 29
 import com.dmdirc.WritableFrameContainer;
30 30
 import com.dmdirc.config.prefs.PreferencesInterface;
31
-import com.dmdirc.ui.WindowManager;
32 31
 import com.dmdirc.ui.core.dialogs.sslcertificate.SSLCertificateDialogModel;
33 32
 import com.dmdirc.updater.Update;
34 33
 

+ 0
- 1
src/com/dmdirc/ui/interfaces/Window.java Visa fil

@@ -24,7 +24,6 @@ package com.dmdirc.ui.interfaces;
24 24
 
25 25
 import com.dmdirc.FrameContainer;
26 26
 import com.dmdirc.config.ConfigManager;
27
-import com.dmdirc.ui.messages.IRCDocument;
28 27
 import com.dmdirc.util.StringTranscoder;
29 28
 
30 29
 /**

+ 5
- 5
src/com/dmdirc/ui/messages/ColourManager.java Visa fil

@@ -50,7 +50,7 @@ public final class ColourManager {
50 50
     };
51 51
     
52 52
     /** Actual colours we're using for the 16 IRC colours. */
53
-    private static Color[] IRC_COLOURS = DEFAULT_COLOURS.clone();
53
+    private static Color[] ircColours = DEFAULT_COLOURS.clone();
54 54
        
55 55
     /** Creates a new instance of ColourManager. */
56 56
     private ColourManager() {
@@ -62,11 +62,11 @@ public final class ColourManager {
62 62
     private static void initColours() {        
63 63
         for (int i = 0; i < 16; i++) {
64 64
             if (IdentityManager.getGlobalConfig().hasOptionColour("colour", String.valueOf(i))) {
65
-                IRC_COLOURS[i] = getColour(IdentityManager.getGlobalConfig()
65
+                ircColours[i] = getColour(IdentityManager.getGlobalConfig()
66 66
                         .getOption("colour", String.valueOf(i)));
67 67
                 COLOUR_CACHE.remove(String.valueOf(i));
68
-            } else if (!IRC_COLOURS[i].equals(DEFAULT_COLOURS[i])) {
69
-                IRC_COLOURS[i] = DEFAULT_COLOURS[i];
68
+            } else if (!ircColours[i].equals(DEFAULT_COLOURS[i])) {
69
+                ircColours[i] = DEFAULT_COLOURS[i];
70 70
                 COLOUR_CACHE.remove(String.valueOf(i));
71 71
             } 
72 72
         }
@@ -160,7 +160,7 @@ public final class ColourManager {
160 160
     public static Color getColour(final int number) {
161 161
         
162 162
         if (number >= 0 && number <= 15) {
163
-            return IRC_COLOURS[number];
163
+            return ircColours[number];
164 164
         } else {
165 165
             Logger.userError(ErrorLevel.MEDIUM, "Invalid colour: " + number);
166 166
             return Color.WHITE;

+ 4
- 4
src/com/dmdirc/ui/messages/Formatter.java Visa fil

@@ -39,7 +39,7 @@ public final class Formatter {
39 39
     /**
40 40
      * A cache of types needed by the various formatters.
41 41
      */
42
-    private static final Map<String, Character[]> typeCache
42
+    private static final Map<String, Character[]> TYPE_CACHE
43 43
             = new HashMap<String, Character[]>();
44 44
    
45 45
     /**
@@ -101,14 +101,14 @@ public final class Formatter {
101 101
     private static Object[] castArguments(final String format, final Object[] args) {
102 102
         assert(format != null);
103 103
         
104
-        if (!typeCache.containsKey(format)) {
104
+        if (!TYPE_CACHE.containsKey(format)) {
105 105
             analyseFormat(format, args);
106 106
         }
107 107
         
108 108
         final Object[] res = new Object[args.length];
109 109
         
110 110
         int i = 0;
111
-        for (Character chr : typeCache.get(format)) {
111
+        for (Character chr : TYPE_CACHE.get(format)) {
112 112
             if (i >= args.length) {
113 113
                 break;
114 114
             }
@@ -221,7 +221,7 @@ public final class Formatter {
221 221
             }
222 222
         }
223 223
         
224
-        typeCache.put(format, types);
224
+        TYPE_CACHE.put(format, types);
225 225
     }
226 226
 
227 227
 }

+ 6
- 4
src/com/dmdirc/ui/messages/IRCDocument.java Visa fil

@@ -122,8 +122,9 @@ public class IRCDocument implements Serializable, ConfigChangeListener {
122 122
      */
123 123
     public void addText(final String[] text) {
124 124
         synchronized (lines) {
125
-            lines.add(new Line(container.getStyliser(), text, fontSize, fontName));
126
-            fireLineAdded(lines.indexOf(text));
125
+            final Line line = new Line(container.getStyliser(), text, fontSize, fontName);
126
+            lines.add(line);
127
+            fireLineAdded(lines.indexOf(line));
127 128
         }
128 129
     }
129 130
 
@@ -135,8 +136,9 @@ public class IRCDocument implements Serializable, ConfigChangeListener {
135 136
      */
136 137
     public void addText(final String[] text, final int lineHeight) {
137 138
         synchronized (lines) {
138
-            lines.add(new Line(container.getStyliser(), text, lineHeight, fontName));
139
-            fireLineAdded(lines.indexOf(text));
139
+            final Line line = new Line(container.getStyliser(), text, lineHeight, fontName);
140
+            lines.add(line);
141
+            fireLineAdded(lines.indexOf(line));
140 142
         }
141 143
     }
142 144
 

+ 1
- 1
src/com/dmdirc/ui/messages/Line.java Visa fil

@@ -156,6 +156,6 @@ public class Line {
156 156
     /** {@inheritDoc} */
157 157
     @Override
158 158
     public int hashCode() {
159
-        return getLineParts().hashCode();
159
+        return Arrays.hashCode(getLineParts());
160 160
     }
161 161
 }

+ 32
- 32
src/com/dmdirc/updater/UpdateChecker.java Visa fil

@@ -65,26 +65,26 @@ public final class UpdateChecker implements Runnable {
65 65
     }
66 66
 
67 67
     /** Semaphore used to prevent multiple invocations. */
68
-    private static final Semaphore mutex = new Semaphore(1);
68
+    private static final Semaphore MUTEX = new Semaphore(1);
69 69
 
70 70
     /** A list of components that we're to check. */
71
-    private static final List<UpdateComponent> components
71
+    private static final List<UpdateComponent> COMPONENTS
72 72
             = new ArrayList<UpdateComponent>();
73 73
 
74 74
     /** Our timer. */
75 75
     private static Timer timer = new Timer("Update Checker Timer");
76 76
 
77 77
     /** The list of updates that are available. */
78
-    private static final List<Update> updates = new ArrayList<Update>();
78
+    private static final List<Update> UPDATES = new ArrayList<Update>();
79 79
 
80 80
     /** A list of our listeners. */
81
-    private static final ListenerList listeners = new ListenerList();
81
+    private static final ListenerList LISTENERS = new ListenerList();
82 82
 
83 83
     /** Our current state. */
84 84
     private static STATE status = STATE.IDLE;
85 85
 
86 86
     /** A reference to the listener we use for update status changes. */
87
-    private static final UpdateListener listener = new UpdateListener() {
87
+    private static final UpdateListener LISTENER = new UpdateListener() {
88 88
         @Override
89 89
         public void updateStatusChange(final Update update, final UpdateStatus status) {
90 90
             if (status == UpdateStatus.INSTALLED
@@ -103,9 +103,9 @@ public final class UpdateChecker implements Runnable {
103 103
     };
104 104
 
105 105
     static {
106
-        components.add(new ClientComponent());
107
-        components.add(new ModeAliasesComponent());
108
-        components.add(new DefaultsComponent());
106
+        COMPONENTS.add(new ClientComponent());
107
+        COMPONENTS.add(new ModeAliasesComponent());
108
+        COMPONENTS.add(new DefaultsComponent());
109 109
     }
110 110
 
111 111
     /**
@@ -118,7 +118,7 @@ public final class UpdateChecker implements Runnable {
118 118
     /** {@inheritDoc} */
119 119
     @Override
120 120
     public void run() {
121
-        if (!mutex.tryAcquire()) {
121
+        if (!MUTEX.tryAcquire()) {
122 122
             // Duplicate invocation
123 123
 
124 124
             return;
@@ -131,7 +131,7 @@ public final class UpdateChecker implements Runnable {
131 131
             IdentityManager.getConfigIdentity().setOption("updater",
132 132
                     "lastcheck", String.valueOf((int) (new Date().getTime() / 1000)));
133 133
         
134
-            mutex.release();
134
+            MUTEX.release();
135 135
             init();
136 136
             return;
137 137
         }
@@ -139,9 +139,9 @@ public final class UpdateChecker implements Runnable {
139 139
         setStatus(STATE.CHECKING);
140 140
 
141 141
         // Remove any existing update that isn't waiting for a restart.
142
-        for (Update update : new ArrayList<Update>(updates)) {
142
+        for (Update update : new ArrayList<Update>(UPDATES)) {
143 143
             if (update.getStatus() != UpdateStatus.RESTART_NEEDED) {
144
-                updates.remove(update);
144
+                UPDATES.remove(update);
145 145
             }
146 146
         }
147 147
 
@@ -149,7 +149,7 @@ public final class UpdateChecker implements Runnable {
149 149
         final String updateChannel = config.getOption("updater", "channel");
150 150
 
151 151
         // Build the data string to send to the server
152
-        for (UpdateComponent component : components) {
152
+        for (UpdateComponent component : COMPONENTS) {
153 153
             if (isEnabled(component)) {
154 154
                 data.append(component.getName());
155 155
                 data.append(',');
@@ -177,14 +177,14 @@ public final class UpdateChecker implements Runnable {
177 177
             }
178 178
         }
179 179
 
180
-        if (updates.isEmpty()) {
180
+        if (UPDATES.isEmpty()) {
181 181
             setStatus(STATE.IDLE);
182 182
         } else {
183 183
             boolean available = false;
184 184
 
185 185
             // Check to see if the updates are outstanding or just waiting for
186 186
             // a restart
187
-            for (Update update : updates) {
187
+            for (Update update : UPDATES) {
188 188
                 if (update.getStatus() == UpdateStatus.PENDING) {
189 189
                     available = true;
190 190
                 }
@@ -193,7 +193,7 @@ public final class UpdateChecker implements Runnable {
193 193
             setStatus(available ? STATE.UPDATES_AVAILABLE : STATE.RESTART_REQUIRED);
194 194
         }
195 195
 
196
-        mutex.release();
196
+        MUTEX.release();
197 197
         
198 198
         IdentityManager.getConfigIdentity().setOption("updater",
199 199
                 "lastcheck", String.valueOf((int) (new Date().getTime() / 1000)));
@@ -240,8 +240,8 @@ public final class UpdateChecker implements Runnable {
240 240
         final Update update = new Update(line);
241 241
 
242 242
         if (update.getUrl() != null) {
243
-            updates.add(update);
244
-            update.addUpdateListener(listener);
243
+            UPDATES.add(update);
244
+            update.addUpdateListener(LISTENER);
245 245
         }
246 246
     }
247 247
 
@@ -292,7 +292,7 @@ public final class UpdateChecker implements Runnable {
292 292
      * @param component The component to be registered
293 293
      */
294 294
     public static void registerComponent(final UpdateComponent component) {
295
-        components.add(component);
295
+        COMPONENTS.add(component);
296 296
     }
297 297
 
298 298
     /**
@@ -303,14 +303,14 @@ public final class UpdateChecker implements Runnable {
303 303
     public static void removeComponent(final String name) {
304 304
         UpdateComponent target = null;
305 305
 
306
-        for (UpdateComponent component : components) {
306
+        for (UpdateComponent component : COMPONENTS) {
307 307
             if (name.equals(component.getName())) {
308 308
                 target = component;
309 309
             }
310 310
         }
311 311
 
312 312
         if (target != null) {
313
-            components.remove(target);
313
+            COMPONENTS.remove(target);
314 314
         }
315 315
     }
316 316
 
@@ -324,7 +324,7 @@ public final class UpdateChecker implements Runnable {
324 324
     public static UpdateComponent findComponent(final String name) {
325 325
         assert(name != null);
326 326
 
327
-        for (UpdateComponent component : components) {
327
+        for (UpdateComponent component : COMPONENTS) {
328 328
             if (name.equals(component.getName())) {
329 329
                 return component;
330 330
             }
@@ -341,10 +341,10 @@ public final class UpdateChecker implements Runnable {
341 341
      * @param update The update to be removed
342 342
      */
343 343
     public static void removeUpdate(final Update update) {
344
-        update.removeUpdateListener(listener);
345
-        updates.remove(update);
344
+        update.removeUpdateListener(LISTENER);
345
+        UPDATES.remove(update);
346 346
 
347
-        if (updates.isEmpty()) {
347
+        if (UPDATES.isEmpty()) {
348 348
             setStatus(STATE.IDLE);
349 349
         } else if (status == STATE.UPDATING) {
350 350
             doNextUpdate();
@@ -355,7 +355,7 @@ public final class UpdateChecker implements Runnable {
355 355
      * Downloads and installs all known updates.
356 356
      */
357 357
     public static void applyUpdates() {
358
-        if (!updates.isEmpty()) {
358
+        if (!UPDATES.isEmpty()) {
359 359
             setStatus(STATE.UPDATING);
360 360
             doNextUpdate();
361 361
         }
@@ -368,7 +368,7 @@ public final class UpdateChecker implements Runnable {
368 368
     private static void doNextUpdate() {
369 369
         boolean restart = false;
370 370
         
371
-        for (Update update : updates) {
371
+        for (Update update : UPDATES) {
372 372
             if (update.getStatus() == UpdateStatus.PENDING) {
373 373
                 update.doUpdate();
374 374
                 return;
@@ -386,7 +386,7 @@ public final class UpdateChecker implements Runnable {
386 386
      * @return A list of registered components
387 387
      */
388 388
     public static List<UpdateComponent> getComponents() {
389
-        return components;
389
+        return COMPONENTS;
390 390
     }
391 391
 
392 392
     /**
@@ -395,7 +395,7 @@ public final class UpdateChecker implements Runnable {
395 395
      * @return A list of available updates
396 396
      */
397 397
     public static List<Update> getAvailableUpdates() {
398
-        return updates;
398
+        return UPDATES;
399 399
     }
400 400
 
401 401
 
@@ -405,7 +405,7 @@ public final class UpdateChecker implements Runnable {
405 405
      * @param listener The listener to be added
406 406
      */
407 407
     public static void addListener(final UpdateCheckerListener listener) {
408
-        listeners.add(UpdateCheckerListener.class, listener);
408
+        LISTENERS.add(UpdateCheckerListener.class, listener);
409 409
     }
410 410
 
411 411
     /**
@@ -414,7 +414,7 @@ public final class UpdateChecker implements Runnable {
414 414
      * @param listener The listener to be removed
415 415
      */
416 416
     public static void removeListener(final UpdateCheckerListener listener) {
417
-        listeners.remove(UpdateCheckerListener.class, listener);
417
+        LISTENERS.remove(UpdateCheckerListener.class, listener);
418 418
     }
419 419
 
420 420
     /**
@@ -434,7 +434,7 @@ public final class UpdateChecker implements Runnable {
434 434
     private static void setStatus(final STATE newStatus) {
435 435
         status = newStatus;
436 436
 
437
-        for (UpdateCheckerListener myListener : listeners.get(UpdateCheckerListener.class)) {
437
+        for (UpdateCheckerListener myListener : LISTENERS.get(UpdateCheckerListener.class)) {
438 438
             myListener.statusChanged(newStatus);
439 439
         }
440 440
     }

+ 6
- 6
src/com/dmdirc/updater/Version.java Visa fil

@@ -64,11 +64,11 @@ public class Version implements Comparable<Version> {
64 64
         } else if (o.strVersion != null && this.strVersion == null) {
65 65
             return -1;
66 66
         } else {
67
-            final String myParts[] = this.strVersion.split("-");
68
-            final String thParts[] = o.strVersion.split("-");
67
+            final String[] myParts = this.strVersion.split("-");
68
+            final String[] thParts = o.strVersion.split("-");
69 69
 
70
-            final String myFirstParts[] = myParts[0].split("\\.|(?=a|b|rc|m)");
71
-            final String thFirstParts[] = thParts[0].split("\\.|(?=a|b|rc|m)");
70
+            final String[] myFirstParts = myParts[0].split("\\.|(?=a|b|rc|m)");
71
+            final String[] thFirstParts = thParts[0].split("\\.|(?=a|b|rc|m)");
72 72
 
73 73
             for (int i = 0; i < Math.max(myFirstParts.length, thFirstParts.length); i++) {
74 74
                 final boolean myExists = myFirstParts.length > i;
@@ -98,8 +98,8 @@ public class Version implements Comparable<Version> {
98 98
                 } else if (thIsInt && myIsInt) {
99 99
                     return myInt - thInt;
100 100
                 } else {
101
-                    final String myLetterParts[] = myFirstParts[i].split("(?=[0-9])", 2);
102
-                    final String thLetterParts[] = thFirstParts[i].split("(?=[0-9])", 2);
101
+                    final String[] myLetterParts = myFirstParts[i].split("(?=[0-9])", 2);
102
+                    final String[] thLetterParts = thFirstParts[i].split("(?=[0-9])", 2);
103 103
 
104 104
                     if (myLetterParts[0].equals(thLetterParts[0])) {
105 105
                         return Integer.parseInt(myLetterParts[1])

+ 3
- 3
src/com/dmdirc/updater/components/PluginComponent.java Visa fil

@@ -43,7 +43,7 @@ public class PluginComponent implements UpdateComponent, FileComponent {
43 43
     private final PluginInfo plugin;
44 44
 
45 45
     /** The config to use. */
46
-    private static final ConfigManager config = IdentityManager.getGlobalConfig();
46
+    private static final ConfigManager CONFIG = IdentityManager.getGlobalConfig();
47 47
 
48 48
     /**
49 49
      * Creates a new PluginComponent for the specified plugin, to enable it to
@@ -55,7 +55,7 @@ public class PluginComponent implements UpdateComponent, FileComponent {
55 55
         this.plugin = plugin;
56 56
 
57 57
         if ((plugin.getAddonID() > 0 && plugin.getVersion().isValid())
58
-                || (config.hasOptionInt("plugin-addonid", plugin.getName()))) {
58
+                || (CONFIG.hasOptionInt("plugin-addonid", plugin.getName()))) {
59 59
             UpdateChecker.removeComponent(getName());
60 60
             UpdateChecker.registerComponent(this);
61 61
         }
@@ -67,7 +67,7 @@ public class PluginComponent implements UpdateComponent, FileComponent {
67 67
         if (plugin.getAddonID() > 0) {
68 68
             return "addon-" + plugin.getAddonID();
69 69
         } else {
70
-            return "addon-" + config.getOption("plugin-addonid", plugin.getName());
70
+            return "addon-" + CONFIG.getOption("plugin-addonid", plugin.getName());
71 71
         }
72 72
     }
73 73
 

+ 9
- 9
src/net/miginfocom/Base64.java Visa fil

@@ -140,7 +140,7 @@ public class Base64 {
140 140
      *            little faster.
141 141
      * @return A BASE64 encoded array. Never <code>null</code>.
142 142
      */
143
-    public final static char[] encodeToChar(final byte[] sArr,
143
+    public static final char[] encodeToChar(final byte[] sArr,
144 144
             final boolean lineSep) {
145 145
         // Check special case
146 146
         final int sLen = sArr != null ? sArr.length : 0;
@@ -206,7 +206,7 @@ public class Base64 {
206 206
      *         (including '=') isn't divideable by 4. (I.e. definitely
207 207
      *         corrupted).
208 208
      */
209
-    public final static byte[] decode(final char[] sArr) {
209
+    public static final byte[] decode(final char[] sArr) {
210 210
         // Check special case
211 211
         final int sLen = sArr != null ? sArr.length : 0;
212 212
         if (sLen == 0) {
@@ -281,7 +281,7 @@ public class Base64 {
281 281
      *            <code>null</code> will throw an exception.
282 282
      * @return The decoded array of bytes. May be of length 0.
283 283
      */
284
-    public final static byte[] decodeFast(final char[] sArr) {
284
+    public static final byte[] decodeFast(final char[] sArr) {
285 285
         // Check special case
286 286
         final int sLen = sArr.length;
287 287
         if (sLen == 0) {
@@ -366,7 +366,7 @@ public class Base64 {
366 366
      *            little faster.
367 367
      * @return A BASE64 encoded array. Never <code>null</code>.
368 368
      */
369
-    public final static byte[] encodeToByte(final byte[] sArr,
369
+    public static final byte[] encodeToByte(final byte[] sArr,
370 370
             final boolean lineSep) {
371 371
         // Check special case
372 372
         final int sLen = sArr != null ? sArr.length : 0;
@@ -432,7 +432,7 @@ public class Base64 {
432 432
      *         (including '=') isn't divideable by 4. (I.e. definitely
433 433
      *         corrupted).
434 434
      */
435
-    public final static byte[] decode(final byte[] sArr) {
435
+    public static final byte[] decode(final byte[] sArr) {
436 436
         // Check special case
437 437
         final int sLen = sArr.length;
438 438
 
@@ -506,7 +506,7 @@ public class Base64 {
506 506
      *            <code>null</code> will throw an exception.
507 507
      * @return The decoded array of bytes. May be of length 0.
508 508
      */
509
-    public final static byte[] decodeFast(final byte[] sArr) {
509
+    public static final byte[] decodeFast(final byte[] sArr) {
510 510
         // Check special case
511 511
         final int sLen = sArr.length;
512 512
         if (sLen == 0) {
@@ -591,7 +591,7 @@ public class Base64 {
591 591
      *            little faster.
592 592
      * @return A BASE64 encoded array. Never <code>null</code>.
593 593
      */
594
-    public final static String encodeToString(final byte[] sArr,
594
+    public static final String encodeToString(final byte[] sArr,
595 595
             final boolean lineSep) {
596 596
         // Reuse char[] since we can't create a String incrementally anyway and
597 597
         // StringBuffer/Builder would be slower.
@@ -615,7 +615,7 @@ public class Base64 {
615 615
      *         (including '=') isn't divideable by 4. (I.e. definitely
616 616
      *         corrupted).
617 617
      */
618
-    public final static byte[] decode(final String str) {
618
+    public static final byte[] decode(final String str) {
619 619
         // Check special case
620 620
         final int sLen = str != null ? str.length() : 0;
621 621
         if (sLen == 0) {
@@ -691,7 +691,7 @@ public class Base64 {
691 691
      *            <code>null</code> will throw an exception.
692 692
      * @return The decoded array of bytes. May be of length 0.
693 693
      */
694
-    public final static byte[] decodeFast(final String s) {
694
+    public static final byte[] decodeFast(final String s) {
695 695
         // Check special case
696 696
         final int sLen = s.length();
697 697
         if (sLen == 0) {

+ 0
- 3
test/com/dmdirc/ServerManagerTest.java Visa fil

@@ -24,12 +24,9 @@ package com.dmdirc;
24 24
 
25 25
 import com.dmdirc.config.IdentityManager;
26 26
 import com.dmdirc.addons.ui_dummy.DummyController;
27
-import com.dmdirc.addons.ui_dummy.DummyQueryWindow;
28 27
 import com.dmdirc.parser.common.ChannelJoinRequest;
29 28
 import com.dmdirc.plugins.PluginManager;
30 29
 
31
-import java.net.URI;
32
-import java.net.URISyntaxException;
33 30
 import org.junit.After;
34 31
 import org.junit.BeforeClass;
35 32
 import org.junit.Test;

+ 1
- 1
test/com/dmdirc/TopicTest.java Visa fil

@@ -45,7 +45,7 @@ public class TopicTest {
45 45
     @Test
46 46
     public void testGetTime() {
47 47
         final Topic test = new Topic("abc", "123!456@789", 1);
48
-        assertEquals(1l, test.getTime());
48
+        assertEquals(1L, test.getTime());
49 49
     }
50 50
 
51 51
     @Test

+ 3
- 6
test/com/dmdirc/actions/ActionComponentChainTest.java Visa fil

@@ -54,20 +54,17 @@ public class ActionComponentChainTest {
54 54
 
55 55
     @Test(expected=IllegalArgumentException.class)
56 56
     public void testInvalidName() {
57
-        final ActionComponentChain chain = new ActionComponentChain(String.class,
58
-                "STRONG_STRING");
57
+        new ActionComponentChain(String.class, "STRONG_STRING");
59 58
     }
60 59
 
61 60
     @Test(expected=IllegalArgumentException.class)
62 61
     public void testInvalidType() {
63
-        final ActionComponentChain chain = new ActionComponentChain(String.class,
64
-                "USER_MODES.STRING_STRING");
62
+        new ActionComponentChain(String.class, "USER_MODES.STRING_STRING");
65 63
     }
66 64
 
67 65
     @Test(expected=IllegalArgumentException.class)
68 66
     public void testInvalidLink() {
69
-        final ActionComponentChain chain = new ActionComponentChain(String.class,
70
-                "STRING_STRING.USER_MODES");
67
+        new ActionComponentChain(String.class, "STRING_STRING.USER_MODES");
71 68
     }
72 69
 
73 70
     @Test

+ 8
- 8
test/com/dmdirc/actions/ActionSubstitutorTest.java Visa fil

@@ -45,7 +45,7 @@ import static org.mockito.Mockito.*;
45 45
 @RunWith(Parameterized.class)
46 46
 public class ActionSubstitutorTest {
47 47
 
48
-    private static final Map<String, String> settings = new HashMap<String, String>();
48
+    private static final Map<String, String> SETTINGS = new HashMap<String, String>();
49 49
     
50 50
     private final String input, expected;
51 51
     private final Channel channel;
@@ -57,11 +57,11 @@ public class ActionSubstitutorTest {
57 57
         IdentityManager.load();
58 58
         ActionManager.init();
59 59
 
60
-        settings.put("alpha", "A");
61
-        settings.put("bravo", "$alpha");
62
-        settings.put("charlie", "${bravo}");
63
-        settings.put("delta", "${${bravo}${bravo}}");
64
-        settings.put("AA", "win!");
60
+        SETTINGS.put("alpha", "A");
61
+        SETTINGS.put("bravo", "$alpha");
62
+        SETTINGS.put("charlie", "${bravo}");
63
+        SETTINGS.put("delta", "${${bravo}${bravo}}");
64
+        SETTINGS.put("AA", "win!");
65 65
     }
66 66
 
67 67
     public ActionSubstitutorTest(final String input, final String expected) {
@@ -81,8 +81,8 @@ public class ActionSubstitutorTest {
81 81
         when(server.getAwayMessage()).thenReturn("foo");
82 82
         when(server.getProtocol()).thenReturn("$alpha");
83 83
 
84
-        when(manager.getOptions(eq("actions"))).thenReturn(settings);
85
-        for (Map.Entry<String, String> entry : settings.entrySet()) {
84
+        when(manager.getOptions(eq("actions"))).thenReturn(SETTINGS);
85
+        for (Map.Entry<String, String> entry : SETTINGS.entrySet()) {
86 86
             when(manager.hasOptionString("actions", entry.getKey())).thenReturn(true);
87 87
             when(manager.getOption("actions", entry.getKey())).thenReturn(entry.getValue());
88 88
         }

+ 0
- 1
test/com/dmdirc/commandparser/commands/chat/MeTest.java Visa fil

@@ -21,7 +21,6 @@
21 21
  */
22 22
 package com.dmdirc.commandparser.commands.chat;
23 23
 
24
-import com.dmdirc.Channel;
25 24
 import com.dmdirc.FrameContainer;
26 25
 import com.dmdirc.MessageTarget;
27 26
 import com.dmdirc.commandparser.CommandArguments;

+ 1
- 5
test/com/dmdirc/commandparser/parsers/CommandParserTest.java Visa fil

@@ -23,12 +23,8 @@ package com.dmdirc.commandparser.parsers;
23 23
 
24 24
 import com.dmdirc.harness.TestCommandParser;
25 25
 import com.dmdirc.commandparser.CommandManager;
26
-import com.dmdirc.commandparser.commands.Command;
27 26
 import com.dmdirc.commandparser.commands.global.Echo;
28 27
 import com.dmdirc.config.IdentityManager;
29
-import com.dmdirc.ui.interfaces.InputWindow;
30
-
31
-import java.util.Arrays;
32 28
 
33 29
 import org.junit.BeforeClass;
34 30
 import org.junit.Test;
@@ -151,7 +147,7 @@ public class CommandParserTest {
151 147
         assertTrue(time2 > 0);
152 148
         assertTrue(time2 >= time1);
153 149
         
154
-        assertEquals(0l, tcp.getCommandTime("echo"));
150
+        assertEquals(0L, tcp.getCommandTime("echo"));
155 151
     }    
156 152
 
157 153
 }

+ 0
- 1
test/com/dmdirc/commandparser/parsers/GlobalCommandParserTest.java Visa fil

@@ -23,7 +23,6 @@
23 23
 package com.dmdirc.commandparser.parsers;
24 24
 
25 25
 import com.dmdirc.config.IdentityManager;
26
-import org.junit.Before;
27 26
 import org.junit.BeforeClass;
28 27
 import org.junit.Test;
29 28
 import static org.junit.Assert.*;

+ 1
- 1
test/com/dmdirc/config/prefs/PluginPreferencesCategoryTest.java Visa fil

@@ -22,7 +22,7 @@
22 22
 package com.dmdirc.config.prefs;
23 23
 
24 24
 import com.dmdirc.plugins.PluginInfo;
25
-import java.util.List;
25
+
26 26
 import org.junit.BeforeClass;
27 27
 import org.junit.Test;
28 28
 import static org.junit.Assert.*;

+ 0
- 1
test/com/dmdirc/harness/TestCommandParser.java Visa fil

@@ -29,7 +29,6 @@ import com.dmdirc.commandparser.parsers.*;
29 29
 import com.dmdirc.commandparser.CommandManager;
30 30
 import com.dmdirc.commandparser.CommandType;
31 31
 import com.dmdirc.commandparser.commands.Command;
32
-import com.dmdirc.ui.interfaces.InputWindow;
33 32
 import com.dmdirc.ui.interfaces.Window;
34 33
 
35 34
 public class TestCommandParser extends CommandParser {

+ 6
- 1
test/com/dmdirc/logger/NullOutputStreamTest.java Visa fil

@@ -21,6 +21,7 @@
21 21
  */
22 22
 package com.dmdirc.logger;
23 23
 
24
+import com.dmdirc.util.StreamUtil;
24 25
 import java.io.IOException;
25 26
 import org.junit.Test;
26 27
 import static org.junit.Assert.*;
@@ -31,10 +32,14 @@ public class NullOutputStreamTest {
31 32
     public void testWrite() {
32 33
         boolean exception = false;
33 34
         
35
+        final NullOutputStream os = new NullOutputStream();
36
+
34 37
         try {
35
-            new NullOutputStream().write(46);
38
+            os.write(46);
36 39
         } catch (IOException ex) {
37 40
             exception = true;
41
+        } finally {
42
+            StreamUtil.close(os);
38 43
         }
39 44
         
40 45
         assertFalse(exception);

+ 1
- 1
test/com/dmdirc/ui/WindowManagerTest.java Visa fil

@@ -74,7 +74,7 @@ public class WindowManagerTest {
74 74
     public void testRemoveRoot() {
75 75
         final FrameListener tfm = mock(FrameListener.class);
76 76
         final Window parent = new DummyInputWindow(new TestWritableFrameContainer<DummyInputWindow>(512, DummyInputWindow.class), null);
77
-        final Window child = new DummyInputWindow(new TestWritableFrameContainer<DummyInputWindow>(512, DummyInputWindow.class), null);        WindowManager.addWindow(parent);
77
+        WindowManager.addWindow(parent);
78 78
         WindowManager.addFrameListener(tfm);
79 79
 
80 80
         WindowManager.removeWindow(parent);

+ 0
- 1
test/com/dmdirc/ui/messages/ColourManagerTest.java Visa fil

@@ -26,7 +26,6 @@ import com.dmdirc.config.IdentityManager;
26 26
 
27 27
 import java.awt.Color;
28 28
 
29
-import org.junit.Before;
30 29
 import org.junit.BeforeClass;
31 30
 import org.junit.Test;
32 31
 import static org.junit.Assert.*;

+ 2
- 2
test/com/dmdirc/updater/UpdateTest.java Visa fil

@@ -36,14 +36,14 @@ public class UpdateTest {
36 36
         IdentityManager.load();
37 37
     }
38 38
     
39
-    private final String subject = "outofdate client channel date version url";
39
+    private static final String SUBJECT = "outofdate client channel date version url";
40 40
     
41 41
     private Update update;
42 42
 
43 43
     @Before
44 44
     public void setUp() throws Exception {
45 45
         UpdateChecker.init();
46
-        update = new Update(subject);
46
+        update = new Update(SUBJECT);
47 47
     }
48 48
 
49 49
     @Test

Laddar…
Avbryt
Spara