Browse Source

PMD Fixes.

Change-Id: Ib0eb65bdf8a076e3a45c116aa6d493de43cf7a2d
Reviewed-on: http://gerrit.dmdirc.com/1744
Reviewed-by: Chris Smith <chris@dmdirc.com>
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
tags/0.6.5
Greg Holmes 13 years ago
parent
commit
2aff3901a3

+ 1
- 1
src/com/dmdirc/addons/dcc/DCCPlugin.java View File

@@ -416,7 +416,7 @@ public final class DCCPlugin extends Plugin implements ActionListener {
416 416
             tmpFilename = tmpFilename.replace('/', File.separatorChar);
417 417
         }
418 418
         // Then get just the name of the file.
419
-        filename = (new File(tmpFilename)).getName();
419
+        filename = new File(tmpFilename).getName();
420 420
 
421 421
         final String ip = ctcpData[++i];
422 422
         final String port = ctcpData[++i];

+ 8
- 8
src/com/dmdirc/addons/dcc/kde/KDialogProcess.java View File

@@ -27,7 +27,7 @@ import java.io.IOException;
27 27
 import java.util.ArrayList;
28 28
 
29 29
 /**
30
- * Hold a Process and stream readers for a KDialog Process
30
+ * Hold a Process and stream readers for a KDialog Process.
31 31
  */
32 32
 public class KDialogProcess {
33 33
 
@@ -37,17 +37,17 @@ public class KDialogProcess {
37 37
     /** Does KDialog exist? */
38 38
     private static final boolean HAS_KDIALOG = IS_BIN || new File("/usr/bin/kdialog").exists();
39 39
 
40
-    /** Stream for the stdout stream for this process */
40
+    /** Stream for the stdout stream for this process. */
41 41
     private final StreamReader stdOutputStream;
42 42
 
43
-    /** Stream for the stderr stream for this process */
43
+    /** Stream for the stderr stream for this process. */
44 44
     private final StreamReader stdErrorStream;
45 45
 
46
-    /** The actual process for this process */
46
+    /** The actual process for this process. */
47 47
     private final Process process;
48 48
 
49 49
     /**
50
-     * Execute kdialog with the Parameters in params
50
+     * Execute kdialog with the Parameters in params.
51 51
      *
52 52
      * @param params Parameters to pass to kdialog
53 53
      * @throws IOException if an I/O error occurs
@@ -73,7 +73,7 @@ public class KDialogProcess {
73 73
     }
74 74
 
75 75
     /**
76
-     * Get the process object for this KDialogProcess
76
+     * Get the process object for this KDialogProcess.
77 77
      *
78 78
      * @return The process object for this KDialogProcess
79 79
      */
@@ -82,7 +82,7 @@ public class KDialogProcess {
82 82
     }
83 83
 
84 84
     /**
85
-     * Get the StreamReader for this KDialogProcess's stdout stream
85
+     * Get the StreamReader for this KDialogProcess's stdout stream.
86 86
      *
87 87
      * @return The StreamReader for this KDialogProcess's stdout stream
88 88
      */
@@ -91,7 +91,7 @@ public class KDialogProcess {
91 91
     }
92 92
 
93 93
     /**
94
-     * Get the StreamReader for this KDialogProcess's stderr stream
94
+     * Get the StreamReader for this KDialogProcess's stderr stream.
95 95
      *
96 96
      * @return The StreamReader for this KDialogProcess's stderr stream
97 97
      */

+ 5
- 5
src/com/dmdirc/addons/logging/LoggingPlugin.java View File

@@ -88,7 +88,7 @@ public class LoggingPlugin extends Plugin implements ActionListener,
88 88
     /** Cached int settings. */
89 89
     private int historyLines, backbufferLines;
90 90
 
91
-    /** Open File */
91
+    /** Open File. */
92 92
     protected static class OpenFile {
93 93
 
94 94
         /** Last used time. */
@@ -108,7 +108,7 @@ public class LoggingPlugin extends Plugin implements ActionListener,
108 108
 
109 109
     }
110 110
 
111
-    /** Timer used to close idle files */
111
+    /** Timer used to close idle files. */
112 112
     protected Timer idleFileTimer;
113 113
 
114 114
     /** Map of open files. */
@@ -257,7 +257,7 @@ public class LoggingPlugin extends Plugin implements ActionListener,
257 257
     }
258 258
 
259 259
     /**
260
-     * Log a query-related event
260
+     * Log a query-related event.
261 261
      *
262 262
      * @param type The type of the event to process
263 263
      * @param format Format of messages that are about to be sent. (May be null)
@@ -320,7 +320,7 @@ public class LoggingPlugin extends Plugin implements ActionListener,
320 320
     }
321 321
 
322 322
     /**
323
-     * Log a channel-related event
323
+     * Log a channel-related event.
324 324
      *
325 325
      * @param type The type of the event to process
326 326
      * @param format Format of messages that are about to be sent. (May be null)
@@ -642,7 +642,7 @@ public class LoggingPlugin extends Plugin implements ActionListener,
642 642
 
643 643
         if (usedate) {
644 644
             final String dateFormat = usedateformat;
645
-            final String dateDir = (new SimpleDateFormat(dateFormat)).format(new Date());
645
+            final String dateDir = new SimpleDateFormat(dateFormat).format(new Date());
646 646
             directory.append(dateDir);
647 647
             if (directory.charAt(directory.length() - 1) != File.separatorChar) {
648 648
                 directory.append(File.separatorChar);

+ 1
- 1
src/com/dmdirc/addons/parser_twitter/Twitter.java View File

@@ -1530,7 +1530,7 @@ public class Twitter implements Parser, TwitterErrorHandler, TwitterRawHandler,
1530 1530
         getCallbackManager().getCallbackType(NumericListener.class).call(numeric, token);
1531 1531
         final StringBuffer output = new StringBuffer();
1532 1532
         for (final String bit : token) {
1533
-            output.append(" ");
1533
+            output.append(' ');
1534 1534
             output.append(bit);
1535 1535
         }
1536 1536
         getCallbackManager().getCallbackType(DataInListener.class).call(output.toString().trim());

+ 5
- 7
src/com/dmdirc/addons/relaybot/RelayBotPlugin.java View File

@@ -87,7 +87,7 @@ public class RelayBotPlugin extends Plugin implements ActionListener, ConfigChan
87 87
             }
88 88
         }
89 89
     }
90
-    
90
+
91 91
     /** {@inheritDoc} */
92 92
     @Override
93 93
     public void onUnload() {
@@ -153,9 +153,7 @@ public class RelayBotPlugin extends Plugin implements ActionListener, ConfigChan
153 153
 
154 154
             // Unset any listeners for channels of this server
155 155
             for (String channel : server.getChannels()) {
156
-                final Channel chan = server.getChannel(channel);
157
-                final String channelName = chan.getServer().getParser().getStringConverter().toLowerCase(chan.getName());
158
-                removeHandler(chan);
156
+                removeHandler(server.getChannel(channel));
159 157
             }
160 158
         }
161 159
     }
@@ -163,7 +161,7 @@ public class RelayBotPlugin extends Plugin implements ActionListener, ConfigChan
163 161
     /** {@inheritDoc} */
164 162
     @Override
165 163
     public void configChanged(final String domain, final String key) {
166
-        final boolean wasUnset = !(IdentityManager.getGlobalConfig().hasOptionString(domain, key));
164
+        final boolean wasUnset = !IdentityManager.getGlobalConfig().hasOptionString(domain, key);
167 165
 
168 166
         for (Server server : ServerManager.getServerManager().getServers()) {
169 167
             if (server.hasChannel(key)) {
@@ -182,8 +180,8 @@ public class RelayBotPlugin extends Plugin implements ActionListener, ConfigChan
182 180
      * If we have one, we will return true.
183 181
      * If we should have one (as determined by checking the config) we will add
184 182
      * one and return true.
185
-     * 
186
-     * @param channel
183
+     *
184
+     * @param channel Channel to check
187 185
      * @return true or false
188 186
      */
189 187
     public boolean isListening(final Channel channel) {

+ 2
- 2
src/com/dmdirc/addons/scriptplugin/ScriptCommand.java View File

@@ -47,7 +47,7 @@ import java.util.Map;
47 47
  */
48 48
 public final class ScriptCommand extends Command implements IntelligentCommand,
49 49
         CommandInfo {
50
-    /** My Plugin */
50
+    /** My Plugin. */
51 51
     final ScriptPlugin myPlugin;
52 52
 
53 53
     /**
@@ -91,7 +91,7 @@ public final class ScriptCommand extends Command implements IntelligentCommand,
91 91
                     ScriptEngineWrapper wrapper;
92 92
                     if (IdentityManager.getGlobalConfig().hasOptionString(myPlugin.getDomain(), "eval.baseFile")) {
93 93
                         final String baseFile = myPlugin.getScriptDir()+'/'+IdentityManager.getGlobalConfig().getOption(myPlugin.getDomain(), "eval.baseFile");
94
-                        if ((new File(baseFile)).exists()) {
94
+                        if (new File(baseFile).exists()) {
95 95
                             wrapper = new ScriptEngineWrapper(myPlugin, baseFile);
96 96
                         } else {
97 97
                             wrapper = new ScriptEngineWrapper(myPlugin, null);

+ 1
- 1
src/com/dmdirc/addons/ui_swing/components/expandingsettings/AddOptionPanel.java View File

@@ -166,7 +166,7 @@ public class AddOptionPanel extends JPanel implements ActionListener {
166 166
                 optionName);
167 167
         if ("channel.encoding".equals(optionName)) {
168 168
             ((DefaultComboBoxModel) addInputComboBox.getModel()).removeAllElements();
169
-            for (Object argument: Charset.availableCharsets().keySet()) {
169
+            for (Object argument : Charset.availableCharsets().keySet()) {
170 170
                 ((DefaultComboBoxModel) addInputComboBox.getModel()).addElement(argument);
171 171
             }
172 172
         }

+ 3
- 3
src/com/dmdirc/addons/ui_swing/components/expandingsettings/CurrentOptionsPanel.java View File

@@ -140,10 +140,10 @@ public final class CurrentOptionsPanel extends JPanel implements ActionListener
140 140
                 break;
141 141
             case MULTICHOICE:
142 142
                 if ("channel.encoding".equals(optionName)) {
143
-                    comboboxes.put(optionName, new JComboBox(new DefaultComboBoxModel(Charset.availableCharsets().keySet().toArray())));
143
+                    comboboxes.put(optionName, new JComboBox(
144
+                            new DefaultComboBoxModel(Charset.availableCharsets()
145
+                            .keySet().toArray())));
144 146
                     comboboxes.get(optionName).setSelectedItem(value);
145
-                } else {
146
-                    //Ignore
147 147
                 }
148 148
                 break;
149 149
             default:

+ 9
- 9
src/com/dmdirc/addons/ui_swing/framemanager/buttonbar/ButtonBar.java View File

@@ -84,11 +84,11 @@ public final class ButtonBar implements FrameManager, ActionListener,
84 84
      */
85 85
     private static final long serialVersionUID = 3;
86 86
     /** The default number of buttons per row or column. */
87
-    private static final int cells = 1;
87
+    private static final int NUM_CELLS = 1;
88 88
     /** The default number of buttons to render per {cell,row}. */
89
-    private static final int maxButtons = Integer.MAX_VALUE;
89
+    private static final int MAX_BUTTONS = Integer.MAX_VALUE;
90 90
     /** The default height of buttons. */
91
-    private static final int buttonHeight = 25;
91
+    private static final int BUTTON_HEIGHT = 25;
92 92
     /** A map of windows to the buttons we're using for them. */
93 93
     private final Map<Window, FrameToggleButton> buttons;
94 94
     /** The scrolling panel for our ButtonBar. */
@@ -124,7 +124,7 @@ public final class ButtonBar implements FrameManager, ActionListener,
124 124
                 .HORIZONTAL_SCROLLBAR_NEVER);
125 125
         scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants
126 126
                 .VERTICAL_SCROLLBAR_AS_NEEDED);
127
-        scrollPane.setMinimumSize(new Dimension(0, buttonHeight
127
+        scrollPane.setMinimumSize(new Dimension(0, BUTTON_HEIGHT
128 128
                 + ((int) PlatformDefaults.getUnitValueX("related")
129 129
                 .getValue()) * 2));
130 130
 
@@ -157,7 +157,7 @@ public final class ButtonBar implements FrameManager, ActionListener,
157 157
      * @since 0.6.4
158 158
      */
159 159
     public int getButtonHeight() {
160
-        return buttonHeight;
160
+        return BUTTON_HEIGHT;
161 161
     }
162 162
 
163 163
     /**
@@ -185,7 +185,7 @@ public final class ButtonBar implements FrameManager, ActionListener,
185 185
                 parent.add(scrollPane);
186 186
                 parent.addComponentListener(ButtonBar.this);
187 187
                 ButtonBar.this.buttonWidth = position.isHorizontal()
188
-                        ? 150 : (parent.getWidth() / cells);
188
+                        ? 150 : (parent.getWidth() / NUM_CELLS);
189 189
                 initButtons(WindowManager.getRootWindows());
190 190
                 if (controller.getMainFrame().getActiveFrame() != null) {
191 191
                     selectionChanged(controller.getMainFrame()
@@ -271,7 +271,7 @@ public final class ButtonBar implements FrameManager, ActionListener,
271 271
             button = getButton(window);
272 272
             if (button != null) {
273 273
                 button.setPreferredSize(
274
-                        new Dimension(buttonWidth, buttonHeight));
274
+                        new Dimension(buttonWidth, BUTTON_HEIGHT));
275 275
                 buttonPanel.add(button);
276 276
                 if (!window.getChildren().isEmpty()) {
277 277
                     final ArrayList<FrameContainer<?>> childList = new ArrayList
@@ -316,7 +316,7 @@ public final class ButtonBar implements FrameManager, ActionListener,
316 316
         button.addActionListener(this);
317 317
         button.addMouseListener(this);
318 318
         button.setHorizontalAlignment(SwingConstants.LEFT);
319
-        button.setMinimumSize(new Dimension(0, buttonHeight));
319
+        button.setMinimumSize(new Dimension(0, BUTTON_HEIGHT));
320 320
         button.setMargin(new Insets(0, 0, 0, 0));
321 321
         buttons.put(source, button);
322 322
     }
@@ -396,7 +396,7 @@ public final class ButtonBar implements FrameManager, ActionListener,
396 396
     @Override
397 397
     public void componentResized(final ComponentEvent e) {
398 398
         buttonWidth = position.isHorizontal() ? 150
399
-                : (parent.getWidth() / cells);
399
+                : (parent.getWidth() / NUM_CELLS);
400 400
         relayout();
401 401
     }
402 402
 

Loading…
Cancel
Save