Browse Source

Load more code tidying

git-svn-id: http://svn.dmdirc.com/trunk@3633 00569f92-eb28-0410-84fd-f71c24880f
tags/0.6
Chris Smith 16 years ago
parent
commit
ae4f818d20
30 changed files with 192 additions and 180 deletions
  1. 2
    0
      src/com/dmdirc/addons/mediasource_dcop/DcopMediaSourcePlugin.java
  2. 4
    3
      src/com/dmdirc/addons/nickcolours/NickColourPanel.java
  3. 15
    13
      src/com/dmdirc/addons/windowstatus/WindowStatusPlugin.java
  4. 2
    2
      src/com/dmdirc/commandline/RemoteServer.java
  5. 1
    1
      src/com/dmdirc/commandparser/commands/Command.java
  6. 1
    1
      src/com/dmdirc/commandparser/commands/PreviousCommand.java
  7. 3
    3
      src/com/dmdirc/commandparser/commands/channel/ShowTopic.java
  8. 1
    1
      src/com/dmdirc/commandparser/commands/global/AllServers.java
  9. 5
    6
      src/com/dmdirc/commandparser/commands/global/Debug.java
  10. 4
    4
      src/com/dmdirc/commandparser/commands/global/LoadPlugin.java
  11. 1
    1
      src/com/dmdirc/commandparser/commands/global/ReloadPlugin.java
  12. 1
    1
      src/com/dmdirc/commandparser/commands/global/UnloadPlugin.java
  13. 6
    6
      src/com/dmdirc/commandparser/commands/server/Ignore.java
  14. 1
    1
      src/com/dmdirc/config/prefs/PreferencesCategory.java
  15. 8
    8
      src/com/dmdirc/installer/Installer.java
  16. 10
    18
      src/com/dmdirc/installer/StepConfirm.java
  17. 11
    8
      src/com/dmdirc/installer/StreamReader.java
  18. 5
    5
      src/com/dmdirc/installer/WindowsInstaller.java
  19. 3
    3
      src/com/dmdirc/installer/cliparser/CLIParam.java
  20. 15
    13
      src/com/dmdirc/installer/cliparser/CLIParser.java
  21. 5
    5
      src/com/dmdirc/logger/ErrorManager.java
  22. 2
    2
      src/com/dmdirc/logger/Logger.java
  23. 4
    4
      src/com/dmdirc/logger/ProgramError.java
  24. 6
    5
      src/com/dmdirc/parser/ChannelClientInfo.java
  25. 26
    25
      src/com/dmdirc/parser/ChannelInfo.java
  26. 14
    14
      src/com/dmdirc/parser/ChannelListModeItem.java
  27. 16
    9
      src/com/dmdirc/parser/ClientInfo.java
  28. 12
    10
      src/com/dmdirc/parser/IRCParser.java
  29. 6
    6
      src/com/dmdirc/ui/swing/dialogs/channelsetting/ChannelListModesPane.java
  30. 2
    2
      src/com/dmdirc/ui/swing/dialogs/prefs/SwingPreferencesDialog.java

+ 2
- 0
src/com/dmdirc/addons/mediasource_dcop/DcopMediaSourcePlugin.java View File

@@ -60,11 +60,13 @@ public class DcopMediaSourcePlugin extends Plugin
60 60
     /** {@inheritDoc} */
61 61
     @Override
62 62
     public void onLoad() {
63
+        // Nothing to do
63 64
     }
64 65
     
65 66
     /** {@inheritDoc} */
66 67
     @Override
67 68
     public void onUnload() {
69
+        // Nothing to do
68 70
     }
69 71
     
70 72
     /** {@inheritDoc} */

+ 4
- 3
src/com/dmdirc/addons/nickcolours/NickColourPanel.java View File

@@ -66,7 +66,8 @@ public class NickColourPanel extends JPanel implements ActionListener,
66 66
     private final transient NickColourPlugin plugin;
67 67
     
68 68
     /** The table headings. */
69
-    private final String[] headers = {"Network", "Nickname", "Text colour", "Nicklist colour"};
69
+    private static final String[] headers
70
+            = {"Network", "Nickname", "Text colour", "Nicklist colour"};
70 71
     
71 72
     /**
72 73
      * Creates a new instance of NickColourPanel.
@@ -223,13 +224,13 @@ public class NickColourPanel extends JPanel implements ActionListener,
223 224
     public void save() {
224 225
         // Remove all old config entries
225 226
         for (Object[] parts : plugin.getData()) {
226
-            IdentityManager.getConfigIdentity().unsetOption(plugin.DOMAIN,
227
+            IdentityManager.getConfigIdentity().unsetOption(NickColourPlugin.DOMAIN,
227 228
                     "color:" + parts[0] + ":" + parts[1]);
228 229
         }
229 230
  	
230 231
         // And write the new ones
231 232
         for (Object[] row : getData()) {
232
-            IdentityManager.getConfigIdentity().setOption(plugin.DOMAIN,
233
+            IdentityManager.getConfigIdentity().setOption(NickColourPlugin.DOMAIN,
233 234
                     "color:" + row[0] + ":" + row[1], row[2] + ":" + row[3]);
234 235
         }
235 236
     }

+ 15
- 13
src/com/dmdirc/addons/windowstatus/WindowStatusPlugin.java View File

@@ -47,6 +47,7 @@ import com.dmdirc.ui.interfaces.Window;
47 47
 import net.miginfocom.swing.MigLayout;
48 48
 
49 49
 import java.util.Hashtable;
50
+import java.util.Map;
50 51
 import java.util.Map.Entry;
51 52
 import java.util.Properties;
52 53
 
@@ -85,7 +86,7 @@ public final class WindowStatusPlugin extends Plugin implements ActionListener {
85 86
 	 */
86 87
 	public void onLoad() {
87 88
 		// Set defaults
88
-		Properties defaults = new Properties();
89
+		final Properties defaults = new Properties();
89 90
 		defaults.setProperty(MY_DOMAIN + ".channel.shownone", "true");
90 91
 		defaults.setProperty(MY_DOMAIN + ".channel.noneprefix", "None:");
91 92
 		defaults.setProperty(MY_DOMAIN + ".client.showname", "false");
@@ -124,11 +125,10 @@ public final class WindowStatusPlugin extends Plugin implements ActionListener {
124 125
 	 * Update the window status using the current active window.
125 126
 	 */
126 127
 	public void updateStatus() {
127
-		Window active = Main.getUI().getActiveWindow();
128
+		final Window active = Main.getUI().getActiveWindow();
128 129
 
129 130
 		if (active != null) {
130
-			FrameContainer activeFrame = ((InputWindow) active).getContainer();
131
-			updateStatus(activeFrame);
131
+			updateStatus(((InputWindow) active).getContainer());
132 132
 		}
133 133
 	}
134 134
 
@@ -139,23 +139,23 @@ public final class WindowStatusPlugin extends Plugin implements ActionListener {
139 139
 	 */
140 140
 	public void updateStatus(final FrameContainer current) {
141 141
 		if (current == null) { return; }
142
-		StringBuffer textString = new StringBuffer("");
142
+		final StringBuffer textString = new StringBuffer();
143 143
 
144 144
 		if (current instanceof Server) {
145
-			Server frame = (Server)current;
145
+			final Server frame = (Server)current;
146 146
 
147 147
 			textString.append(frame.getName());
148 148
 		} else if (current instanceof Channel) {
149 149
 			final Channel frame = (Channel)current;
150 150
 			final ChannelInfo chan = frame.getChannelInfo();
151
-			final Hashtable<Long,String> names = new Hashtable<Long,String>();
152
-			final Hashtable<Long,Integer> types = new Hashtable<Long,Integer>();
151
+			final Map<Long,String> names = new Hashtable<Long,String>();
152
+			final Map<Long,Integer> types = new Hashtable<Long,Integer>();
153 153
 
154 154
 			textString.append(chan.getName());
155 155
 			textString.append(" - Nicks: "+chan.getUserCount()+" (");
156 156
 
157 157
 			for (ChannelClientInfo client : chan.getChannelClients()) {
158
-				Long im = client.getImportantModeValue();
158
+				final Long im = client.getImportantModeValue();
159 159
 
160 160
 				if (!names.containsKey(im)) {
161 161
 					String mode = client.getImportantModePrefix();
@@ -187,11 +187,12 @@ public final class WindowStatusPlugin extends Plugin implements ActionListener {
187 187
 			boolean isFirst = true;
188 188
 
189 189
 			for (Entry<Long, Integer> entry : types.entrySet()) {
190
-				if (isFirst) { isFirst = false; } else { textString.append(" "); }
191
-				textString.append(names.get(entry.getKey())+entry.getValue());
190
+				if (isFirst) { isFirst = false; } else { textString.append(' '); }
191
+				textString.append(names.get(entry.getKey()));
192
+                textString.append(entry.getValue());
192 193
 			}
193 194
 
194
-			textString.append(")");
195
+			textString.append(')');
195 196
 		} else if (current instanceof Query) {
196 197
 			final Query frame = (Query)current;
197 198
 
@@ -201,7 +202,8 @@ public final class WindowStatusPlugin extends Plugin implements ActionListener {
201 202
 				if (client != null) {
202 203
 					final String realname = client.getRealName();
203 204
 					if (!realname.isEmpty()) {
204
-						textString.append(" - "+client.getRealName());
205
+						textString.append(" - ");
206
+                        textString.append(client.getRealName());
205 207
 					}
206 208
 				}
207 209
 			}

+ 2
- 2
src/com/dmdirc/commandline/RemoteServer.java View File

@@ -62,9 +62,9 @@ public class RemoteServer implements RemoteInterface {
62 62
     public static void bind() {
63 63
         try {
64 64
             final RemoteServer server = new RemoteServer();
65
-            RemoteInterface stub =
65
+            final RemoteInterface stub =
66 66
                 (RemoteInterface) UnicastRemoteObject.exportObject(server, 0);
67
-            Registry registry = LocateRegistry.createRegistry(1099);
67
+            final Registry registry = LocateRegistry.createRegistry(1099);
68 68
             registry.rebind("DMDirc", stub);
69 69
         } catch (RemoteException ex) {
70 70
             // Do nothing

+ 1
- 1
src/com/dmdirc/commandparser/commands/Command.java View File

@@ -105,7 +105,7 @@ public abstract class Command extends CommandInfo implements Comparable<Command>
105 105
      * @return A string containing an ASCII table
106 106
      */
107 107
     protected static String doTable(final String[] headers, final String[][] data) {
108
-        StringBuilder res = new StringBuilder();
108
+        final StringBuilder res = new StringBuilder();
109 109
         res.append(Styliser.CODE_FIXED);
110 110
         res.append(Styliser.CODE_BOLD);
111 111
         

+ 1
- 1
src/com/dmdirc/commandparser/commands/PreviousCommand.java View File

@@ -89,7 +89,7 @@ public final class PreviousCommand {
89 89
     @Override
90 90
     public int hashCode() {
91 91
         int hash = 5;
92
-        hash = 97 * hash + (this.line != null ? this.line.hashCode() : 0);
92
+        hash = 97 * hash + (this.line == null ? 0 : this.line.hashCode());
93 93
         return hash;
94 94
     }
95 95
     

+ 3
- 3
src/com/dmdirc/commandparser/commands/channel/ShowTopic.java View File

@@ -50,11 +50,11 @@ public final class ShowTopic extends ChannelCommand implements ExternalCommand {
50 50
         if (args.length == 0) {
51 51
             final ChannelInfo cChannel = channel.getChannelInfo();
52 52
 
53
-            if (!cChannel.getTopic().isEmpty()) {
53
+            if (cChannel.getTopic().isEmpty()) {
54
+                sendLine(origin, isSilent, "channelNoTopic", cChannel);
55
+            } else {
54 56
                 sendLine(origin, isSilent, "channelJoinTopic", cChannel.getTopic(),
55 57
                         cChannel.getTopicUser(), 1000 * cChannel.getTopicTime(), cChannel);
56
-            } else {
57
-                sendLine(origin, isSilent, "channelNoTopic", cChannel);
58 58
             }
59 59
         } else {
60 60
             channel.setTopic(implodeArgs(args));

+ 1
- 1
src/com/dmdirc/commandparser/commands/global/AllServers.java View File

@@ -29,8 +29,8 @@ import com.dmdirc.commandparser.commands.GlobalCommand;
29 29
 import com.dmdirc.commandparser.commands.IntelligentCommand;
30 30
 import com.dmdirc.ui.input.AdditionalTabTargets;
31 31
 import com.dmdirc.ui.input.TabCompleter;
32
-import com.dmdirc.ui.input.TabCompletionType;
33 32
 import com.dmdirc.ui.interfaces.InputWindow;
33
+
34 34
 import java.util.List;
35 35
 
36 36
 /**

+ 5
- 6
src/com/dmdirc/commandparser/commands/global/Debug.java View File

@@ -84,7 +84,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
84 84
         } else if ("serverinfo".equals(args[0])) {
85 85
             doServerInfo(origin, isSilent);
86 86
         } else if ("benchmark".equals(args[0])) {
87
-            doBenchmark(origin, isSilent);
87
+            doBenchmark(origin);
88 88
         } else if ("firstrun".equals(args[0])) {
89 89
             Main.getUI().showFirstRunWizard();
90 90
         } else if ("migration".equals(args[0])) {
@@ -261,19 +261,18 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
261 261
      * Benchmarks the textpane.
262 262
      * 
263 263
      * @param origin The window this command was executed in
264
-     * @param isSilent Whether this command has been silenced or not
265 264
      */
266
-    private void doBenchmark(final InputWindow origin, final boolean isSilent) {
265
+    private void doBenchmark(final InputWindow origin) {
267 266
         long[] results = new long[10];
268 267
         
269 268
         for (int i = 0; i < results.length; i++) {
270
-            long start = System.nanoTime();
269
+            final long start = System.nanoTime();
271 270
             
272 271
             for (int j = 0; j < 5000; j++) {
273 272
                 origin.addLine(FORMAT_OUTPUT, "This is a benchmark. Lorem ipsum doler...");
274 273
             }
275 274
             
276
-            long end = System.nanoTime();
275
+            final long end = System.nanoTime();
277 276
             
278 277
             results[i] = end - start;
279 278
         }
@@ -303,7 +302,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
303 302
     
304 303
     /** {@inheritDoc} */
305 304
     @Override
306
-    public AdditionalTabTargets getSuggestions(int arg, List<String> previousArgs) {
305
+    public AdditionalTabTargets getSuggestions(final int arg, final List<String> previousArgs) {
307 306
         final AdditionalTabTargets res = new AdditionalTabTargets();
308 307
         
309 308
         res.excludeAll();

+ 4
- 4
src/com/dmdirc/commandparser/commands/global/LoadPlugin.java View File

@@ -59,15 +59,15 @@ public final class LoadPlugin extends GlobalCommand implements IntelligentComman
59 59
             PluginManager.getPluginManager().getPluginInfo(args[0]).loadPlugin();
60 60
             sendLine(origin, isSilent, FORMAT_OUTPUT, "Plugin loaded.");
61 61
         } else {
62
-            PluginInfo plugin = PluginManager.getPluginManager().getPluginInfo(args[0]);
62
+            final PluginInfo plugin = PluginManager.getPluginManager().getPluginInfo(args[0]);
63 63
             if (plugin == null) {
64 64
                 sendLine(origin, isSilent, FORMAT_ERROR, "Plugin Loading failed");
65 65
             } else {
66
-                if (!plugin.isLoaded()) {
66
+                if (plugin.isLoaded()) {
67
+                    sendLine(origin, isSilent, FORMAT_OUTPUT, "Plugin already loaded.");
68
+                } else {
67 69
                     PluginManager.getPluginManager().getPluginInfo(args[0]).loadPlugin();
68 70
                     sendLine(origin, isSilent, FORMAT_OUTPUT, "Plugin loaded.");
69
-                } else {
70
-                    sendLine(origin, isSilent, FORMAT_OUTPUT, "Plugin already loaded.");
71 71
                 }
72 72
             }
73 73
         }

+ 1
- 1
src/com/dmdirc/commandparser/commands/global/ReloadPlugin.java View File

@@ -57,7 +57,7 @@ public final class ReloadPlugin extends GlobalCommand implements IntelligentComm
57 57
             return;
58 58
         }
59 59
         
60
-        PluginInfo plugin = PluginManager.getPluginManager().getPluginInfoByName(args[0]);
60
+        final PluginInfo plugin = PluginManager.getPluginManager().getPluginInfoByName(args[0]);
61 61
         if (plugin == null) {
62 62
             sendLine(origin, isSilent, FORMAT_ERROR, "Plugin Reloading failed - Plugin not loaded");
63 63
         } else {

+ 1
- 1
src/com/dmdirc/commandparser/commands/global/UnloadPlugin.java View File

@@ -57,7 +57,7 @@ public final class UnloadPlugin extends GlobalCommand implements IntelligentComm
57 57
             return;
58 58
         }
59 59
         
60
-        PluginInfo plugin = PluginManager.getPluginManager().getPluginInfoByName(args[0]);
60
+        final PluginInfo plugin = PluginManager.getPluginManager().getPluginInfoByName(args[0]);
61 61
         if (plugin == null) {
62 62
             sendLine(origin, isSilent, FORMAT_ERROR, "Plugin unloading failed - Plugin not loaded");
63 63
         } else {

+ 6
- 6
src/com/dmdirc/commandparser/commands/server/Ignore.java View File

@@ -66,7 +66,11 @@ public final class Ignore extends ServerCommand implements IntelligentCommand {
66 66
             if (identity.hasOption("network", "ignorelist")) {
67 67
                 final List<String> list = identity.getOptionList("network", "ignorelist");
68 68
                 
69
-                if (!list.isEmpty()) {
69
+                if (list.isEmpty()) {
70
+                    sendLine(origin, isSilent, FORMAT_ERROR,
71
+                            "No ignore list entries for this network.");
72
+
73
+                } else {
70 74
                     sendLine(origin, isSilent, FORMAT_OUTPUT, "Ignore list:");
71 75
                     
72 76
                     int i = 0;
@@ -75,11 +79,7 @@ public final class Ignore extends ServerCommand implements IntelligentCommand {
75 79
                             i++;
76 80
                             sendLine(origin, isSilent, FORMAT_OUTPUT, i + ". " + line);
77 81
                         }
78
-                    }
79
-                    
80
-                } else {
81
-                    sendLine(origin, isSilent, FORMAT_ERROR,
82
-                            "No ignore list entries for this network.");
82
+                    }                    
83 83
                 }
84 84
                 
85 85
             } else {

+ 1
- 1
src/com/dmdirc/config/prefs/PreferencesCategory.java View File

@@ -119,7 +119,7 @@ public class PreferencesCategory {
119 119
      * 
120 120
      * @return True if subcats should be displayed first, false otherwise.
121 121
      */
122
-    public boolean getInlineBefore() {
122
+    public boolean isInlineBefore() {
123 123
         return inlineBefore;
124 124
     }
125 125
     

+ 8
- 8
src/com/dmdirc/installer/Installer.java View File

@@ -66,6 +66,7 @@ public abstract class Installer extends Thread {
66 66
 	/**
67 67
 	 * This step performs the installation, via the StepInstall step.
68 68
 	 */
69
+    @Override
69 70
 	public final void run() {
70 71
 		step.performInstall(this);
71 72
 	}
@@ -82,7 +83,6 @@ public abstract class Installer extends Thread {
82 83
 	 * Main Setup stuff
83 84
 	 *
84 85
 	 * @param location Location where app will be installed to.
85
-	 * @param step The step that called this
86 86
 	 * @return True if installation passed, else false; 
87 87
 	 */
88 88
 	public boolean doSetup(final String location) {
@@ -91,15 +91,15 @@ public abstract class Installer extends Thread {
91 91
 		if (!directory.exists()) { directory.mkdir(); }
92 92
 	
93 93
 		try {
94
-			File dir = new File(".");
95
-			FilenameFilter filter = new FilenameFilter() {
96
-				public boolean accept(File dir, String name) {
97
-					return !name.startsWith(".") &&
94
+			final File dir = new File(".");
95
+			final FilenameFilter filter = new FilenameFilter() {
96
+				public boolean accept(final File dir, final String name) {
97
+					return name.charAt(0) != '.' &&
98 98
 					       !name.equalsIgnoreCase("installer.jar") &&
99 99
 					       validFile(name);
100 100
 				}
101 101
 			};
102
-			String[] children = dir.list(filter);
102
+			final String[] children = dir.list(filter);
103 103
 			if (children != null) {
104 104
 				for (String filename : children) {
105 105
 					step.addText("Copying "+filename);
@@ -141,8 +141,8 @@ public abstract class Installer extends Thread {
141 141
 	 */
142 142
 	protected final void copyFile(final String srcFile, final String dstFile) throws IOException {
143 143
 		if (new File(srcFile).exists()) {
144
-			FileChannel srcChannel = new FileInputStream(srcFile).getChannel();
145
-			FileChannel dstChannel = new FileOutputStream(dstFile).getChannel();
144
+			final FileChannel srcChannel = new FileInputStream(srcFile).getChannel();
145
+			final FileChannel dstChannel = new FileOutputStream(dstFile).getChannel();
146 146
 			
147 147
 			dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
148 148
 			

+ 10
- 18
src/com/dmdirc/installer/StepConfirm.java View File

@@ -46,7 +46,7 @@ public final class StepConfirm extends Step implements StepListener {
46 46
 	private static final long serialVersionUID = 2;
47 47
 
48 48
 	/** Text area showing the install information */
49
-	private JWrappingLabel infoLabel = new JWrappingLabel("");
49
+	private final JWrappingLabel infoLabel = new JWrappingLabel("");
50 50
 
51 51
 	/**
52 52
 	* Creates a new instance of StepConfirm.
@@ -70,30 +70,22 @@ public final class StepConfirm extends Step implements StepListener {
70 70
 		if (step != this) { return; }
71 71
 		String shortcutText = "";
72 72
 
73
-		StepSettings settings = ((StepSettings) Main.getWizardFrame().getStep(1));
73
+		final StepSettings settings = ((StepSettings) Main.getWizardFrame().getStep(1));
74 74
 
75
-		if (Main.getInstaller().supportsShortcut(ShortcutType.MENU)) {
76
-			if (settings.getShortcutMenuState()) {
77
-				shortcutText = shortcutText + " - Create menu shortcut"+ "\n";
78
-			}
75
+		if (Main.getInstaller().supportsShortcut(ShortcutType.MENU) && settings.getShortcutMenuState()) {
76
+			shortcutText = shortcutText + " - Create menu shortcut\n";
79 77
 		}
80 78
 
81
-		if (Main.getInstaller().supportsShortcut(ShortcutType.DESKTOP)) {
82
-			if (settings.getShortcutDesktopState()) {
83
-				shortcutText = shortcutText + " - Create desktop shortcut"+ "\n";
84
-			}
79
+		if (Main.getInstaller().supportsShortcut(ShortcutType.DESKTOP) && settings.getShortcutDesktopState()) {
80
+			shortcutText = shortcutText + " - Create desktop shortcut\n";
85 81
 		}
86 82
 
87
-		if (Main.getInstaller().supportsShortcut(ShortcutType.QUICKLAUNCH)) {
88
-			if (settings.getShortcutQuickState()) {
89
-				shortcutText = shortcutText + " - Create Quick Launch shortcut"+ "\n";
90
-			}
83
+		if (Main.getInstaller().supportsShortcut(ShortcutType.QUICKLAUNCH) && settings.getShortcutQuickState()) {
84
+			shortcutText = shortcutText + " - Create Quick Launch shortcut\n";
91 85
 		}
92 86
 
93
-		if (Main.getInstaller().supportsShortcut(ShortcutType.PROTOCOL)) {
94
-			if (settings.getShortcutProtocolState()) {
95
-				shortcutText = shortcutText + " - Make DMDirc handle irc:// links"+ "\n";
96
-			}
87
+		if (Main.getInstaller().supportsShortcut(ShortcutType.PROTOCOL) && settings.getShortcutProtocolState()) {
88
+			shortcutText = shortcutText + " - Make DMDirc handle irc:// links\n";
97 89
 		}
98 90
 
99 91
 

+ 11
- 8
src/com/dmdirc/installer/StreamReader.java View File

@@ -28,8 +28,9 @@ import java.io.InputStream;
28 28
 import java.io.InputStreamReader;
29 29
 
30 30
 public class StreamReader extends Thread {
31
+    
31 32
 	/** This is the Input Stream we are reading */
32
-	private InputStream stream;
33
+	private final InputStream stream;
33 34
 	
34 35
 	/** This is the output Prefix */
35 36
 	private String prefix = null;
@@ -58,23 +59,25 @@ public class StreamReader extends Thread {
58 59
 		this.prefix = prefix;
59 60
 		this.step = step;
60 61
 		
61
-		if (step != null) {
62
-			step.addText(String.format(" - -[%s] Started", prefix));
63
-		} else {
62
+		if (step == null) {
64 63
 			System.out.printf("[%s] Started%n", prefix);
64
+		} else {
65
+			step.addText(String.format(" - -[%s] Started", prefix));
65 66
 		}
66 67
 	}
67 68
 
69
+    /** {@inheritDoc} */
70
+    @Override
68 71
 	public void run() {
69
-		BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
72
+		final BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
70 73
 		try {
71 74
 			String line;
72 75
 			while ((line = reader.readLine()) != null) {
73 76
 				if (prefix != null) {
74
-					if (step != null) {
75
-						step.addText(String.format(" - -[%s] %s", prefix, line));
76
-					} else {
77
+					if (step == null) {
77 78
 						System.out.printf("[%s] %s%n", prefix, line);
79
+					} else {
80
+						step.addText(String.format(" - -[%s] %s", prefix, line));
78 81
 					}
79 82
 				}
80 83
 			}

+ 5
- 5
src/com/dmdirc/installer/WindowsInstaller.java View File

@@ -158,15 +158,15 @@ public class WindowsInstaller extends Installer {
158 158
 		params.add("add");
159 159
 		params.add(key);
160 160
 		params.add("/f");
161
-		if (!value.isEmpty()) {
161
+		if (value.isEmpty()) {
162
+			params.add("/ve");
163
+		} else {
162 164
 			params.add("/v");
163 165
 			params.add(value);
164
-		} else {
165
-			params.add("/ve");
166 166
 		}
167 167
 		params.add("/t");
168 168
 		params.add(type);
169
-		if (!data.equals("")) {
169
+		if (!data.isEmpty()) {
170 170
 			params.add("/d");
171 171
 			params.add(data);
172 172
 		}
@@ -273,7 +273,7 @@ public class WindowsInstaller extends Installer {
273 273
 			if (!dir.exists()) { dir.mkdir(); }
274 274
 
275 275
 			// Delete an older shortcut
276
-			File oldFile = new File(filename+"\\DMDirc.lnk");
276
+			final File oldFile = new File(filename+"\\DMDirc.lnk");
277 277
 			if (oldFile.exists()) { oldFile.delete(); }
278 278
 
279 279
 			try {

+ 3
- 3
src/com/dmdirc/installer/cliparser/CLIParam.java View File

@@ -29,11 +29,11 @@ package com.dmdirc.installer.cliparser;
29 29
  */
30 30
 public abstract class CLIParam {
31 31
 	/** Single Character flag for this param. */
32
-	private char charFlag;
32
+	private final char charFlag;
33 33
 	/** String flag for this param. */
34
-	private String stringFlag;
34
+	private final String stringFlag;
35 35
 	/** Description of this flag. */
36
-	private String description;
36
+	private final String description;
37 37
 	/** Number of times this param has been given. */
38 38
 	private int number;
39 39
 	

+ 15
- 13
src/com/dmdirc/installer/cliparser/CLIParser.java View File

@@ -26,6 +26,8 @@ package com.dmdirc.installer.cliparser;
26 26
 
27 27
 import java.util.ArrayList;
28 28
 import java.util.Hashtable;
29
+import java.util.List;
30
+import java.util.Map;
29 31
 
30 32
 /**
31 33
  * Command Line argument parser.
@@ -41,19 +43,19 @@ public class CLIParser {
41 43
 	 * Known arguments.
42 44
 	 * This hashtable stores the arguments with their flags as the key.
43 45
 	 */
44
-	private Hashtable<String, CLIParam> params = new Hashtable<String, CLIParam>();
46
+	private final Map<String, CLIParam> params = new Hashtable<String, CLIParam>();
45 47
 	
46 48
 	/**
47 49
 	 * Known arguments.
48 50
 	 * This ArrayList stores every param type. (used for help)
49 51
 	 */
50
-	private ArrayList<CLIParam> paramList = new ArrayList<CLIParam>();
52
+	private final List<CLIParam> paramList = new ArrayList<CLIParam>();
51 53
 	
52 54
 	/**
53 55
 	 * Redundant Strings.
54 56
 	 * This ArrayList stores redundant strings found whilst parsing the params.
55 57
 	 */
56
-	private ArrayList<String> redundant = new ArrayList<String>();
58
+	private final List<String> redundant = new ArrayList<String>();
57 59
 	
58 60
 	/**
59 61
 	 * Get a reference to the CLIParser.
@@ -131,7 +133,7 @@ public class CLIParser {
131 133
 	 *
132 134
 	 * @return list of params.
133 135
 	 */
134
-	public ArrayList<CLIParam> getParamList() {
136
+	public List<CLIParam> getParamList() {
135 137
 		return paramList;
136 138
 	}
137 139
 	
@@ -140,8 +142,8 @@ public class CLIParser {
140 142
 	 *
141 143
 	 * @return list of redundant strings.
142 144
 	 */
143
-	public ArrayList<String> getRedundant() {
144
-		ArrayList<String> result = new ArrayList<String>();
145
+	public List<String> getRedundant() {
146
+		final List<String> result = new ArrayList<String>();
145 147
 		for (String item : redundant) {
146 148
 			result.add(item);
147 149
 		}
@@ -160,15 +162,15 @@ public class CLIParser {
160 162
 	/**
161 163
 	 * Check if the help parameter has been passed to the CLI.
162 164
 	 */
163
-	public boolean wantsHelp(String[] args) {
165
+	public boolean wantsHelp(final String[] args) {
164 166
 		if (helpParam == null) { return false; }
165 167
 		for (String arg : args) {
166 168
 			if (arg.length() > 1 && arg.charAt(0) == '-') {
167
-				String name = arg.substring(1);
169
+				final String name = arg.substring(1);
168 170
 				if (name.equals("-")) {
169 171
 					return false;
170 172
 				} else {
171
-					CLIParam param = getParam(name);
173
+					final CLIParam param = getParam(name);
172 174
 					if (param == helpParam) {
173 175
 						return true;
174 176
 					}
@@ -213,14 +215,12 @@ public class CLIParser {
213 215
 		for (String arg : args) {
214 216
 			if (arg.length() > 1 && arg.charAt(0) == '-' && !allRedundant) {
215 217
 				if (lastParam != null) { lastParam.setValue(""); }
216
-				String name = arg.substring(1);
218
+				final String name = arg.substring(1);
217 219
 				if (name.equals("-")) {
218 220
 					allRedundant = true;
219 221
 				} else {
220 222
 					lastParam = getParam(name);
221
-					if (lastParam != null) {
222
-						lastParam.incNumber();
223
-					} else {
223
+					if (lastParam == null) {
224 224
 						System.out.println("Unknown Param: -"+name);
225 225
 						if (helpParam != null) {
226 226
 							String command = "";
@@ -236,6 +236,8 @@ public class CLIParser {
236 236
 						if (strict) {
237 237
 							System.exit(1);
238 238
 						}
239
+					} else {
240
+						lastParam.incNumber();
239 241
 					}
240 242
 				}
241 243
 			} else {

+ 5
- 5
src/com/dmdirc/logger/ErrorManager.java View File

@@ -177,16 +177,16 @@ public final class ErrorManager implements Serializable, Runnable {
177 177
             }
178 178
         }
179 179
         
180
-        if (!errors.containsValue(error)) {
180
+        if (errors.containsValue(error)) {
181
+            error.setReportStatus(ErrorReportStatus.FINISHED);
182
+            error.setFixedStatus(ErrorFixedStatus.UNREPORTED);
183
+        } else {
181 184
             reportQueue.add(error);
182 185
         
183 186
             if (reportThread == null || !reportThread.isAlive()) {
184 187
                 reportThread = new Thread(this, "Error reporting thread");
185 188
                 reportThread.start();
186 189
             }
187
-        } else {
188
-            error.setReportStatus(ErrorReportStatus.FINISHED);
189
-            error.setFixedStatus(ErrorFixedStatus.UNREPORTED);
190 190
         }
191 191
     }
192 192
     
@@ -194,7 +194,7 @@ public final class ErrorManager implements Serializable, Runnable {
194 194
     /** {@inheritDoc} */
195 195
     @Override
196 196
     public void run() {
197
-        while (reportQueue.size() > 0) {
197
+        while (!reportQueue.isEmpty()) {
198 198
             sendErrorInternal(reportQueue.remove(0));
199 199
             
200 200
             try {

+ 2
- 2
src/com/dmdirc/logger/Logger.java View File

@@ -233,8 +233,8 @@ public final class Logger {
233 233
             }
234 234
             
235 235
             if (throwable.getCause() != null) {
236
-                String[] causeTrace = exceptionToStringArray(throwable.getCause());
237
-                String[] newTrace = new String[trace.length + causeTrace.length];
236
+                final String[] causeTrace = exceptionToStringArray(throwable.getCause());
237
+                final String[] newTrace = new String[trace.length + causeTrace.length];
238 238
                 trace[0] = "\nWhich caused: " + trace[0];
239 239
                 
240 240
                 System.arraycopy(causeTrace, 0, newTrace, 0, causeTrace.length);

+ 4
- 4
src/com/dmdirc/logger/ProgramError.java View File

@@ -190,7 +190,7 @@ public final class ProgramError implements Serializable {
190 190
 
191 191
     /** {@inheritDoc} */
192 192
     @Override
193
-    public boolean equals(Object obj) {
193
+    public boolean equals(final Object obj) {
194 194
         if (obj == null) {
195 195
             return false;
196 196
         }
@@ -214,9 +214,9 @@ public final class ProgramError implements Serializable {
214 214
     @Override
215 215
     public int hashCode() {
216 216
         int hash = 7;
217
-        hash = 67 * hash + (this.level != null ? this.level.hashCode() : 0);
218
-        hash = 67 * hash + (this.message != null ? this.message.hashCode() : 0);
219
-        hash = 67 * hash + (this.trace != null ? Arrays.hashCode(this.trace) : 0);
217
+        hash = 67 * hash + (this.level == null ? 0 : this.level.hashCode());
218
+        hash = 67 * hash + (this.message == null ? 0 : this.message.hashCode());
219
+        hash = 67 * hash + (this.trace == null ? 0 : Arrays.hashCode(this.trace));
220 220
         return hash;
221 221
     }
222 222
     

+ 6
- 5
src/com/dmdirc/parser/ChannelClientInfo.java View File

@@ -37,13 +37,13 @@ import java.util.Map;
37 37
  */
38 38
 public final class ChannelClientInfo {
39 39
 	/** Reference to ClientInfo object this represents. */
40
-	private ClientInfo cClient;
40
+	private final ClientInfo cClient;
41 41
 	/** Integer representation of the channel modes assocated with this user. */
42 42
 	private long nModes;
43 43
 	/** Reference to the parser object that owns this channelclient, Used for modes. */
44
-	private IRCParser myParser;
44
+	private final IRCParser myParser;
45 45
 	/** Reference to the channel object that owns this channelclient. */
46
-	private ChannelInfo myChannel;
46
+	private final ChannelInfo myChannel;
47 47
 	/** A Map to allow applications to attach misc data to this object */
48 48
 	private Map myMap;
49 49
 	
@@ -68,7 +68,7 @@ public final class ChannelClientInfo {
68 68
 	 * @param newMap New Map to attatch.
69 69
 	 * @see #getMap
70 70
 	 */
71
-	public void setMap(Map newMap) {
71
+	public void setMap(final Map newMap) {
72 72
 		myMap = newMap;
73 73
 	}
74 74
 	
@@ -170,7 +170,7 @@ public final class ChannelClientInfo {
170 170
 	 */
171 171
 	public String getImportantMode() {
172 172
 		String sModes = this.getChanModeStr(false);
173
-		if (!sModes.equals("")) { sModes = "" + sModes.charAt(0); }
173
+		if (!sModes.isEmpty()) { sModes = "" + sModes.charAt(0); }
174 174
 		return sModes;
175 175
 	}
176 176
 	
@@ -191,6 +191,7 @@ public final class ChannelClientInfo {
191 191
 	 *
192 192
 	 * @return String Value of user (inc prefix) (ie @Nickname)
193 193
 	 */
194
+    @Override
194 195
 	public String toString() { 
195 196
 		return this.getImportantModePrefix() + this.getNickname();
196 197
 	}	

+ 26
- 25
src/com/dmdirc/parser/ChannelInfo.java View File

@@ -28,6 +28,7 @@ import java.util.ArrayList;
28 28
 import java.util.Hashtable;
29 29
 import java.util.HashMap;
30 30
 import java.util.LinkedList;
31
+import java.util.List;
31 32
 import java.util.Map;
32 33
 import java.util.Queue;
33 34
 
@@ -59,28 +60,29 @@ public final class ChannelInfo {
59 60
 	/** Known boolean-modes for channel. */
60 61
 	private long nModes;
61 62
 	/** Reference to the parser object that owns this channel, Used for modes. */
62
-	private IRCParser myParser; // Reference to parser object that owns this channel. Used for Modes
63
+	private final IRCParser myParser; // Reference to parser object that owns this channel. Used for Modes
63 64
 	
64 65
 	/** Channel Name. */
65
-	private String sName = "";
66
+	private final String sName;
67
+    
66 68
 	/** Hashtable containing references to ChannelClients. */
67
-	private Hashtable<String, ChannelClientInfo> hChannelUserList = new Hashtable<String, ChannelClientInfo>();
69
+	private final Map<String, ChannelClientInfo> hChannelUserList = new Hashtable<String, ChannelClientInfo>();
68 70
 	/** Hashtable storing values for modes set in the channel that use parameters. */
69
-	private Hashtable<Character, String> hParamModes = new Hashtable<Character, String>();
71
+	private final Map<Character, String> hParamModes = new Hashtable<Character, String>();
70 72
 	/** Hashtable storing list modes. */
71
-	private Hashtable<Character, ArrayList<ChannelListModeItem>> hListModes = new Hashtable<Character, ArrayList<ChannelListModeItem>>();
73
+	private final Map<Character, ArrayList<ChannelListModeItem>> hListModes = new Hashtable<Character, ArrayList<ChannelListModeItem>>();
72 74
 	/**
73 75
 	 * LinkedList storing status of mode adding.
74 76
 	 * if an item is in this list for a mode, we are expecting new items for the list
75 77
 	 */
76
-	private LinkedList<Character> lAddingModes = new LinkedList<Character>();
78
+	private final List<Character> lAddingModes = new LinkedList<Character>();
77 79
 	/** Modes waiting to be sent to the server. */
78
-	private LinkedList<String> lModeQueue = new LinkedList<String>();
80
+	private final List<String> lModeQueue = new LinkedList<String>();
79 81
 	/** A Map to allow applications to attach misc data to this object */
80 82
 	private Map myMap;
81 83
 	
82 84
 	/** Queue of requested list modes */
83
-	private Queue<Character> listModeQueue = new LinkedList<Character>();
85
+	private final Queue<Character> listModeQueue = new LinkedList<Character>();
84 86
 	/** Listmode Queue Time */
85 87
 	private long listModeQueueTime = System.currentTimeMillis();
86 88
 	/** Have we asked the server for the list modes for this channel yet? */
@@ -112,7 +114,7 @@ public final class ChannelInfo {
112 114
 		// 60 seconds ago, we reset the list.
113 115
 		if (now-(30*1000) > listModeQueueTime) {
114 116
 			result = new LinkedList<Character>();
115
-			myParser.callDebugInfo(myParser.DEBUG_LMQ, "Resetting LMQ");
117
+			myParser.callDebugInfo(IRCParser.DEBUG_LMQ, "Resetting LMQ");
116 118
 		}
117 119
 		listModeQueueTime = now;
118 120
 		return result;
@@ -157,8 +159,8 @@ public final class ChannelInfo {
157 159
 		String listmodes = "";
158 160
 		int i = 0;
159 161
 		for (Character cTemp : myParser.hChanModesOther.keySet()) {
160
-			int nTemp = myParser.hChanModesOther.get(cTemp);
161
-			if (nTemp == myParser.MODE_LIST) {
162
+			final int nTemp = myParser.hChanModesOther.get(cTemp);
163
+			if (nTemp == IRCParser.MODE_LIST) {
162 164
 				if ((isFreenode || isHybrid) && (cTemp == 'e' || cTemp == 'I') && !isOpped) {
163 165
 					// IRCD doesn't allow non-ops to ask for these modes.
164 166
 					continue;
@@ -176,10 +178,10 @@ public final class ChannelInfo {
176 178
 			}
177 179
 		}
178 180
 		if (i > 0) {
179
-			if (!supportLISTMODE) {
180
-				myParser.sendString("MODE "+getName()+" "+listmodes);
181
-			} else {
181
+			if (supportLISTMODE) {
182 182
 				myParser.sendString("LISTMODE "+getName()+" "+listmodes);
183
+			} else {
184
+				myParser.sendString("MODE "+getName()+" "+listmodes);
183 185
 			}
184 186
 		}
185 187
 	}
@@ -216,7 +218,7 @@ public final class ChannelInfo {
216 218
 	 *
217 219
 	 * @param newMap New Map to attatch.
218 220
 	 */
219
-	public void setMap(Map newMap) {
221
+	public void setMap(final Map newMap) {
220 222
 		myMap = newMap;
221 223
 	}
222 224
 	
@@ -261,8 +263,8 @@ public final class ChannelInfo {
261 263
 	 *
262 264
 	 * @return ArrayList of ChannelClients
263 265
 	 */
264
-	public ArrayList<ChannelClientInfo> getChannelClients() {
265
-		final ArrayList<ChannelClientInfo> lClients = new ArrayList<ChannelClientInfo>();
266
+	public List<ChannelClientInfo> getChannelClients() {
267
+		final List<ChannelClientInfo> lClients = new ArrayList<ChannelClientInfo>();
266 268
 		for (ChannelClientInfo client : hChannelUserList.values()) {
267 269
 			lClients.add(client);
268 270
 		}
@@ -338,7 +340,7 @@ public final class ChannelInfo {
338 340
 		ChannelClientInfo cTemp = null;
339 341
 		cTemp = getUser(cClient);
340 342
 		if (cTemp != null) {
341
-			ClientInfo clTemp = cTemp.getClient();
343
+			final ClientInfo clTemp = cTemp.getClient();
342 344
 			clTemp.delChannelClientInfo(cTemp);
343 345
 			if (clTemp != myParser.getMyself() && !clTemp.checkVisibility()) {
344 346
 				myParser.removeClient(clTemp);
@@ -496,8 +498,7 @@ public final class ChannelInfo {
496 498
 	protected void setListModeParam(final Character givenMode, final ChannelListModeItem givenItem, final boolean bAdd) { 
497 499
 		Character cMode = givenMode;
498 500
 		ChannelListModeItem newItem = givenItem;
499
-		if (!myParser.hChanModesOther.containsKey(cMode)) { return; }
500
-		else if (myParser.hChanModesOther.get(cMode) != myParser.MODE_LIST) { return; }
501
+		if (!myParser.hChanModesOther.containsKey(cMode) || myParser.hChanModesOther.get(cMode) != IRCParser.MODE_LIST) { return; }
501 502
 		
502 503
 		// Hyperion sucks.
503 504
 		if (cMode == 'b' || cMode == 'q') {
@@ -536,9 +537,8 @@ public final class ChannelInfo {
536 537
 	 * @param cMode Character representing mode
537 538
 	 * @return ArrayList containing ChannelListModeItem in the list, or null if mode is invalid
538 539
 	 */
539
-	public ArrayList<ChannelListModeItem> getListModeParam(final Character cMode) { 
540
-		if (!myParser.hChanModesOther.containsKey(cMode)) { return null; }
541
-		else if (myParser.hChanModesOther.get(cMode) != myParser.MODE_LIST) { return null; }
540
+	public List<ChannelListModeItem> getListModeParam(final Character cMode) { 
541
+		if (!myParser.hChanModesOther.containsKey(cMode) || myParser.hChanModesOther.get(cMode) != myParser.MODE_LIST) { return null; }
542 542
 		
543 543
 		if (!hListModes.containsKey(cMode)) { 
544 544
 			hListModes.put(cMode, new ArrayList<ChannelListModeItem>());
@@ -634,7 +634,7 @@ public final class ChannelInfo {
634 634
 	 * Modes are always sent negative then positive and not mixed.
635 635
 	 */
636 636
 	public void sendModes() { 
637
-		if (lModeQueue.size() == 0) { return; }
637
+		if (lModeQueue.isEmpty()) { return; }
638 638
 		final StringBuilder positivemode = new StringBuilder();
639 639
 		final StringBuilder positiveparam = new StringBuilder();
640 640
 		final StringBuilder negativemode = new StringBuilder();
@@ -659,7 +659,7 @@ public final class ChannelInfo {
659 659
 		if (positivemode.length() > 0) { sendModeStr.append("+").append(positivemode); }
660 660
 		if (negativeparam.length() > 0) { sendModeStr.append(negativeparam); }
661 661
 		if (positiveparam.length() > 0) { sendModeStr.append(positiveparam); }
662
-		myParser.callDebugInfo(myParser.DEBUG_INFO, "Sending mode: %s", sendModeStr.toString());
662
+		myParser.callDebugInfo(IRCParser.DEBUG_INFO, "Sending mode: %s", sendModeStr.toString());
663 663
 		myParser.sendLine("MODE " + sName + " " + sendModeStr.toString());
664 664
 		clearModeQueue();
665 665
 	}
@@ -734,6 +734,7 @@ public final class ChannelInfo {
734 734
 	 *
735 735
 	 * @return String representation of the Channel.
736 736
 	 */
737
+    @Override
737 738
 	public String toString() { return sName; }
738 739
 	
739 740
 	/**

+ 14
- 14
src/com/dmdirc/parser/ChannelListModeItem.java View File

@@ -33,20 +33,15 @@ package com.dmdirc.parser;
33 33
  * @see IRCParser
34 34
  */
35 35
 public final class ChannelListModeItem {
36
-	/**
37
-	 * The Item itself.
38
-	 */
39
-	private String myItem;
36
+
37
+    /** The Item itself. */
38
+	private final String myItem;
40 39
 	
41
-	/**
42
-	 * The Time the item was created.
43
-	 */
44
-	private long myTime;
40
+	/** The Time the item was created. */
41
+	private final long myTime;
45 42
 	
46
-	/**
47
-	 * The Person who created the item.
48
-	 */
49
-	private String myOwner;
43
+	/** The Person who created the item. */
44
+	private final String myOwner;
50 45
 	
51 46
 	/**
52 47
 	 * Create a new Item.
@@ -58,8 +53,12 @@ public final class ChannelListModeItem {
58 53
 	public ChannelListModeItem(final String item, final String owner, final long time) {
59 54
 		myItem = item;
60 55
 		myTime = time;
61
-		myOwner = owner;
62
-		if (!owner.isEmpty() && owner.charAt(0) == ':') { myOwner = owner.substring(1); }
56
+
57
+		if (!owner.isEmpty() && owner.charAt(0) == ':') {
58
+            myOwner = owner.substring(1);
59
+        } else {
60
+            myOwner = owner;
61
+        }
63 62
 	}
64 63
 	
65 64
 	/**
@@ -88,6 +87,7 @@ public final class ChannelListModeItem {
88 87
 	*
89 88
 	* @return String representation of this object
90 89
 	*/
90
+    @Override
91 91
 	public String toString() {
92 92
 			return getItem();
93 93
 	}

+ 16
- 9
src/com/dmdirc/parser/ClientInfo.java View File

@@ -57,13 +57,13 @@ public final class ClientInfo {
57 57
 	/** Is this a fake client created just for a callback? */
58 58
 	private boolean bIsFake;
59 59
 	/** Reference to the parser object that owns this channel, Used for modes. */
60
-	private IRCParser myParser;
60
+	private final IRCParser myParser;
61 61
 	/** A Map to allow applications to attach misc data to this object */
62 62
 	private Map myMap;
63 63
 	/** List of ChannelClientInfos that point to this */
64
-	private Hashtable<String, ChannelClientInfo> myChannelClientInfos = new Hashtable<String, ChannelClientInfo>();
64
+	private final Map<String, ChannelClientInfo> myChannelClientInfos = new Hashtable<String, ChannelClientInfo>();
65 65
 	/** Modes waiting to be sent to the server. */
66
-	private LinkedList<String> lModeQueue = new LinkedList<String>();
66
+	private final List<String> lModeQueue = new LinkedList<String>();
67 67
 
68 68
 	/**
69 69
 	 * Create a new client object from a hostmask.
@@ -83,7 +83,7 @@ public final class ClientInfo {
83 83
 	 *
84 84
 	 * @param newMap New Map to attatch.
85 85
 	 */
86
-	public void setMap(Map newMap) {
86
+	public void setMap(final Map newMap) {
87 87
 		myMap = newMap;
88 88
 	}
89 89
 	
@@ -107,7 +107,7 @@ public final class ClientInfo {
107 107
 	 *
108 108
 	 * @return True if this client is actually a server.
109 109
 	 */
110
-	public boolean isServer() { return !(sNickname.indexOf(":") == -1); }
110
+	public boolean isServer() { return !(sNickname.indexOf(':') == -1); }
111 111
 	/**
112 112
 	 * Set if this is a fake client.
113 113
 	 * This returns "this" and thus can be used in the construction line.
@@ -115,7 +115,7 @@ public final class ClientInfo {
115 115
 	 * @param newValue new value for isFake - True if this is a fake client, else false
116 116
 	 * @return this Object
117 117
 	 */
118
-	public ClientInfo setFake(boolean newValue) { bIsFake = newValue; return this; }
118
+	public ClientInfo setFake(final boolean newValue) { bIsFake = newValue; return this; }
119 119
 
120 120
 	/**
121 121
 	 * Get a nickname of a user from a hostmask.
@@ -181,6 +181,7 @@ public final class ClientInfo {
181 181
 	 *
182 182
 	 * @return String representation of the user.
183 183
 	 */
184
+    @Override
184 185
 	public String toString() { return sNickname + "!" + sIdent + "@" + sHost; }
185 186
 	
186 187
 	/**
@@ -189,12 +190,14 @@ public final class ClientInfo {
189 190
 	 * @return Known nickname for user.
190 191
 	 */
191 192
 	public String getNickname() { return sNickname; }
193
+    
192 194
 	/**
193 195
 	 * Get the ident for this user.
194 196
 	 *
195 197
 	 * @return Known ident for user. (May be "")
196 198
 	 */		
197 199
 	public String getIdent() { return sIdent; }
200
+    
198 201
 	/**
199 202
 	 * Get the hostname for this user.
200 203
 	 *
@@ -212,6 +215,7 @@ public final class ClientInfo {
212 215
 		bIsAway = bNewState;
213 216
 		if (!bIsAway) { myAwayReason = ""; }
214 217
 	}
218
+    
215 219
 	/**
216 220
 	 * Get the away state of a user.
217 221
 	 *
@@ -225,6 +229,7 @@ public final class ClientInfo {
225 229
 	 * @return Known away reason for user.
226 230
 	 */
227 231
 	public String getAwayReason() { return myAwayReason; }
232
+    
228 233
 	/**
229 234
 	 * Set the Away Reason for this user.
230 235
 	 * Automatically set to "" if awaystate is set to false
@@ -239,6 +244,7 @@ public final class ClientInfo {
239 244
 	 * @return Known RealName for user.
240 245
 	 */
241 246
 	public String getRealName() { return sRealName; }
247
+    
242 248
 	/**
243 249
 	 * Set the RealName for this user.
244 250
 	 *
@@ -252,6 +258,7 @@ public final class ClientInfo {
252 258
 	 * @param nNewMode new long representing channel modes. (Boolean only)
253 259
 	 */	
254 260
 	protected void setUserMode(final long nNewMode) { nModes = nNewMode; }
261
+    
255 262
 	/**
256 263
 	 * Get the user modes (as an integer).
257 264
 	 *
@@ -337,7 +344,7 @@ public final class ClientInfo {
337 344
 	 * @return int with the count of known channels
338 345
 	 */	
339 346
 	public List<ChannelClientInfo> getChannelClients() {
340
-		ArrayList<ChannelClientInfo> result = new ArrayList<ChannelClientInfo>();
347
+		final List<ChannelClientInfo> result = new ArrayList<ChannelClientInfo>();
341 348
 		for (ChannelClientInfo cci : myChannelClientInfos.values()) {
342 349
 			result.add(cci);
343 350
 		}
@@ -380,7 +387,7 @@ public final class ClientInfo {
380 387
 	 * Modes are always sent negative then positive and not mixed.
381 388
 	 */
382 389
 	public void sendModes() {
383
-		if (lModeQueue.size() == 0) { return; }
390
+		if (lModeQueue.isEmpty()) { return; }
384 391
 		final StringBuilder positivemode = new StringBuilder();
385 392
 		final StringBuilder negativemode = new StringBuilder();
386 393
 		final StringBuilder sendModeStr = new StringBuilder();
@@ -397,7 +404,7 @@ public final class ClientInfo {
397 404
 		}
398 405
 		if (negativemode.length() > 0) { sendModeStr.append("-").append(negativemode); }
399 406
 		if (positivemode.length() > 0) { sendModeStr.append("+").append(positivemode); }
400
-		myParser.callDebugInfo(myParser.DEBUG_INFO, "Sending mode: %s", sendModeStr.toString());
407
+		myParser.callDebugInfo(IRCParser.DEBUG_INFO, "Sending mode: %s", sendModeStr.toString());
401 408
 		myParser.sendLine("MODE " + sNickname + " " + sendModeStr.toString());
402 409
 		clearModeQueue();
403 410
 	}

+ 12
- 10
src/com/dmdirc/parser/IRCParser.java View File

@@ -53,6 +53,7 @@ import java.util.Arrays;
53 53
 import java.util.Collection;
54 54
 import java.util.Hashtable;
55 55
 import java.util.LinkedList;
56
+import java.util.Map;
56 57
 import java.util.Timer;
57 58
 import java.util.Queue;
58 59
 
@@ -158,16 +159,16 @@ public class IRCParser implements Runnable {
158 159
 	boolean hasBegan;
159 160
 
160 161
 	/** Hashtable storing known prefix modes (ohv). */
161
-	Hashtable<Character, Long> hPrefixModes = new Hashtable<Character, Long>();
162
+	final Map<Character, Long> hPrefixModes = new Hashtable<Character, Long>();
162 163
 	/**
163 164
 	 * Hashtable maping known prefix modes (ohv) to prefixes (@%+) - Both ways.
164 165
 	 * Prefix map contains 2 pairs for each mode. (eg @ => o and o => @)
165 166
 	 */
166
-	Hashtable<Character, Character> hPrefixMap = new Hashtable<Character, Character>();
167
+	final Map<Character, Character> hPrefixMap = new Hashtable<Character, Character>();
167 168
 	/** Integer representing the next avaliable integer value of a prefix mode. */
168 169
 	long nNextKeyPrefix = 1;
169 170
 	/** Hashtable storing known user modes (owxis etc). */
170
-	Hashtable<Character, Long> hUserModes = new Hashtable<Character, Long>();
171
+	final Map<Character, Long> hUserModes = new Hashtable<Character, Long>();
171 172
 	/** Integer representing the next avaliable integer value of a User mode. */
172 173
 	long nNextKeyUser = 1;
173 174
 	/**
@@ -178,7 +179,7 @@ public class IRCParser implements Runnable {
178 179
 	 * <br>
179 180
 	 * Channel modes discovered but not listed in 005 are stored as boolean modes automatically (and a ERROR_WARNING Error is called)
180 181
 	 */
181
-	Hashtable<Character, Long> hChanModesBool = new Hashtable<Character, Long>();
182
+	final Map<Character, Long> hChanModesBool = new Hashtable<Character, Long>();
182 183
 	/** Integer representing the next avaliable integer value of a Boolean mode. */
183 184
 
184 185
 	long nNextKeyCMBool = 1;
@@ -192,7 +193,7 @@ public class IRCParser implements Runnable {
192 193
 	 * see MODE_SET<br>
193 194
 	 * see MODE_UNSET<br>
194 195
 	 */
195
-	Hashtable<Character, Byte> hChanModesOther = new Hashtable<Character, Byte>();
196
+	final Map<Character, Byte> hChanModesOther = new Hashtable<Character, Byte>();
196 197
 
197 198
 	/** The last line of input recieved from the server */
198 199
 	String lastLine = "";
@@ -203,15 +204,15 @@ public class IRCParser implements Runnable {
203 204
 	* Channel Prefixes (ie # + etc).
204 205
 	* The "value" for these is always true.
205 206
 	*/
206
-	Hashtable<Character, Boolean> hChanPrefix = new Hashtable<Character, Boolean>();
207
+	final Map<Character, Boolean> hChanPrefix = new Hashtable<Character, Boolean>();
207 208
 	/** Hashtable storing all known clients based on nickname (in lowercase). */
208
-	private Hashtable<String, ClientInfo> hClientList = new Hashtable<String, ClientInfo>();
209
+	private final Map<String, ClientInfo> hClientList = new Hashtable<String, ClientInfo>();
209 210
 	/** Hashtable storing all known channels based on chanel name (inc prefix - in lowercase). */
210
-	private Hashtable<String, ChannelInfo> hChannelList = new Hashtable<String, ChannelInfo>();
211
+	private final Map<String, ChannelInfo> hChannelList = new Hashtable<String, ChannelInfo>();
211 212
 	/** Reference to the ClientInfo object that references ourself. */
212 213
 	private ClientInfo cMyself = new ClientInfo(this, "myself").setFake(true);
213 214
 	/** Hashtable storing all information gathered from 005. */
214
-	Hashtable<String, String> h005Info = new Hashtable<String, String>();
215
+	final Map<String, String> h005Info = new Hashtable<String, String>();
215 216
 
216 217
 	/** Ignore List. */
217 218
 	RegexStringList myIgnoreList = new RegexStringList();
@@ -787,6 +788,7 @@ public class IRCParser implements Runnable {
787 788
 	}
788 789
 
789 790
 	/** Close socket on destroy. */
791
+    @Override
790 792
 	protected void finalize() throws Throwable {
791 793
 		try { socket.close(); }
792 794
 		catch (IOException e) {
@@ -1742,7 +1744,7 @@ public class IRCParser implements Runnable {
1742 1744
 	 *
1743 1745
 	 * @return 005Info hashtable.
1744 1746
 	 */
1745
-	public Hashtable<String, String> get005() { return h005Info; }
1747
+	public Map<String, String> get005() { return h005Info; }
1746 1748
 
1747 1749
 	/**
1748 1750
 	 * Get the name of the ircd.

+ 6
- 6
src/com/dmdirc/ui/swing/dialogs/channelsetting/ChannelListModesPane.java View File

@@ -88,7 +88,7 @@ public final class ChannelListModesPane extends JPanel implements ActionListener
88 88
     /** Cell renderer. */
89 89
     private ListCellRenderer renderer;
90 90
     /** Extended info toggle. */
91
-    private JCheckBox toggle;
91
+    private final JCheckBox toggle;
92 92
 
93 93
     /**
94 94
      * Creates a new instance of ChannelListModePane.
@@ -146,7 +146,7 @@ public final class ChannelListModesPane extends JPanel implements ActionListener
146 146
             existingListItems.add(mode,
147 147
                     new ArrayList<ChannelListModeItem>(channel.getChannelInfo().
148 148
                     getListModeParam(mode)));
149
-            final ArrayList<ChannelListModeItem> listItems =
149
+            final List<ChannelListModeItem> listItems =
150 150
                     channel.getChannelInfo().getListModeParam(mode);
151 151
             final DefaultListModel model =
152 152
                     (DefaultListModel) listModesPanels.get(i).getModel();
@@ -281,7 +281,7 @@ public final class ChannelListModesPane extends JPanel implements ActionListener
281 281
     /** Adds a list mode. */
282 282
     private void addListMode() {
283 283
         final int selectedIndex = listModesMenu.getSelectedIndex();
284
-        String modeText = "" + listModesArray[selectedIndex];
284
+        String modeText = String.valueOf(listModesArray[selectedIndex]);
285 285
         String modeMask;
286 286
         if (channel.getConfigManager().
287 287
                 hasOption("server", "mode" + listModesArray[selectedIndex])) {
@@ -329,10 +329,10 @@ public final class ChannelListModesPane extends JPanel implements ActionListener
329 329
         } else if (removeListModeButton.equals(event.getSource())) {
330 330
             removeListMode();
331 331
         } else if (toggle.equals(event.getSource())) {
332
-            if (!toggle.isSelected()) {
333
-                renderer = new ListModeCellRenderer();
334
-            } else {
332
+            if (toggle.isSelected()) {
335 333
                 renderer = new ExtendedListModeCellRenderer();
334
+            } else {
335
+                renderer = new ListModeCellRenderer();
336 336
             }
337 337
             for (JList list : listModesPanels) {
338 338
                 list.setCellRenderer(renderer);

+ 2
- 2
src/com/dmdirc/ui/swing/dialogs/prefs/SwingPreferencesDialog.java View File

@@ -423,7 +423,7 @@ public final class SwingPreferencesDialog extends StandardDialog implements
423 423
         }
424 424
 
425 425
         for (PreferencesCategory child : category.getSubcats()) {
426
-            if (child.isInline() && category.getInlineBefore()) {
426
+            if (child.isInline() && category.isInlineBefore()) {
427 427
                 addInlineCategory(child, panel);
428 428
             } else if (!child.isInline()) {
429 429
                 addCategory(child, newNode, path);
@@ -446,7 +446,7 @@ public final class SwingPreferencesDialog extends StandardDialog implements
446 446
             addComponent(category, setting);
447 447
         }
448 448
 
449
-        if (!category.getInlineBefore()) {
449
+        if (!category.isInlineBefore()) {
450 450
             for (PreferencesCategory child : category.getSubcats()) {
451 451
                 if (child.isInline()) {
452 452
                     addInlineCategory(child, panel);

Loading…
Cancel
Save