Browse Source

Assorted tidying.

pull/652/head
Chris Smith 8 years ago
parent
commit
18cb00a6bc

+ 1
- 1
src/com/dmdirc/Channel.java View File

263
         // Needs to be published synchronously so that nicklists are cleared before the parser
263
         // Needs to be published synchronously so that nicklists are cleared before the parser
264
         // is disconnected (which happens synchronously after this method returns).
264
         // is disconnected (which happens synchronously after this method returns).
265
         getEventBus().publish(
265
         getEventBus().publish(
266
-                new NickListClientsChangedEvent(this, Collections.<GroupChatUser>emptyList()));
266
+                new NickListClientsChangedEvent(this, Collections.emptyList()));
267
     }
267
     }
268
 
268
 
269
     @Override
269
     @Override

+ 2
- 2
src/com/dmdirc/FrameContainer.java View File

83
     /** The connection associated with this model. */
83
     /** The connection associated with this model. */
84
     private Optional<Connection> connection = Optional.empty();
84
     private Optional<Connection> connection = Optional.empty();
85
     /** The ID for this window. */
85
     /** The ID for this window. */
86
-    @Nullable private String id = null;
86
+    @Nullable private String id;
87
 
87
 
88
     /**
88
     /**
89
      * Instantiate new frame container.
89
      * Instantiate new frame container.
119
 
119
 
120
     @Override
120
     @Override
121
     public String getId() {
121
     public String getId() {
122
-        if (this.id == null) {
122
+        if (id == null) {
123
             throw new IllegalStateException("ID has not been set");
123
             throw new IllegalStateException("ID has not been set");
124
         }
124
         }
125
         return id;
125
         return id;

+ 1
- 1
src/com/dmdirc/commandline/CommandLineParser.java View File

388
             }
388
             }
389
 
389
 
390
             System.out.print("   -" + arg[0] + needsArg);
390
             System.out.print("   -" + arg[0] + needsArg);
391
-            System.out.println(" --" + desc + needsArg + " " + arg[2]);
391
+            System.out.println(" --" + desc + needsArg + ' ' + arg[2]);
392
             System.out.println();
392
             System.out.println();
393
         }
393
         }
394
 
394
 

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

194
     public String getWordsAsString(final int start, final int end) {
194
     public String getWordsAsString(final int start, final int end) {
195
         checkPositionIndex(start, end);
195
         checkPositionIndex(start, end);
196
 
196
 
197
-        final Pattern pattern = Pattern.compile("(\\S+\\s+){" + start + "}"
197
+        final Pattern pattern = Pattern.compile("(\\S+\\s+){" + start + '}'
198
                 + "((\\S+\\s+){" + Math.max(0, end - start) + "}\\S+(\\s+$)?).*?");
198
                 + "((\\S+\\s+){" + Math.max(0, end - start) + "}\\S+(\\s+$)?).*?");
199
         final Matcher matcher = pattern.matcher(line);
199
         final Matcher matcher = pattern.matcher(line);
200
 
200
 

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

61
             return false;
61
             return false;
62
         }
62
         }
63
         final PreviousCommand other = (PreviousCommand) obj;
63
         final PreviousCommand other = (PreviousCommand) obj;
64
-        return Objects.equals(this.line, other.line) && this.time == other.time;
64
+        return Objects.equals(line, other.line) && time == other.time;
65
     }
65
     }
66
 
66
 
67
 }
67
 }

+ 2
- 2
src/com/dmdirc/commandparser/commands/flags/CommandFlag.java View File

98
      * @param enabled The flags which will be enabled
98
      * @param enabled The flags which will be enabled
99
      */
99
      */
100
     public void addEnabled(final CommandFlag... enabled) {
100
     public void addEnabled(final CommandFlag... enabled) {
101
-        this.enables.addAll(Arrays.asList(enabled));
101
+        enables.addAll(Arrays.asList(enabled));
102
     }
102
     }
103
 
103
 
104
     /**
104
     /**
107
      * @param disabled The flags which will be disabled
107
      * @param disabled The flags which will be disabled
108
      */
108
      */
109
     public void addDisabled(final CommandFlag... disabled) {
109
     public void addDisabled(final CommandFlag... disabled) {
110
-        this.disables.addAll(Arrays.asList(disabled));
110
+        disables.addAll(Arrays.asList(disabled));
111
     }
111
     }
112
 
112
 
113
     /**
113
     /**

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

70
 
70
 
71
         connection.getParser().get().sendRawMessage("MODE "
71
         connection.getParser().get().sendRawMessage("MODE "
72
                 + connection.getParser().get().getLocalClient().getNickname()
72
                 + connection.getParser().get().getLocalClient().getNickname()
73
-                + " " + args.getArgumentsAsString());
73
+                + ' ' + args.getArgumentsAsString());
74
     }
74
     }
75
 
75
 
76
 }
76
 }

+ 0
- 1
src/com/dmdirc/commandparser/parsers/QueryCommandParser.java View File

23
 package com.dmdirc.commandparser.parsers;
23
 package com.dmdirc.commandparser.parsers;
24
 
24
 
25
 import com.dmdirc.DMDircMBassador;
25
 import com.dmdirc.DMDircMBassador;
26
-import com.dmdirc.Query;
27
 import com.dmdirc.commandparser.CommandArguments;
26
 import com.dmdirc.commandparser.CommandArguments;
28
 import com.dmdirc.commandparser.CommandInfo;
27
 import com.dmdirc.commandparser.CommandInfo;
29
 import com.dmdirc.commandparser.CommandType;
28
 import com.dmdirc.commandparser.CommandType;

+ 3
- 3
src/com/dmdirc/config/ConfigFileBackedConfigProvider.java View File

107
             final boolean forceDefault) throws IOException, InvalidIdentityFileException {
107
             final boolean forceDefault) throws IOException, InvalidIdentityFileException {
108
         this.identityManager = null;
108
         this.identityManager = null;
109
         this.file = new ConfigFile(stream);
109
         this.file = new ConfigFile(stream);
110
-        this.file.setAutomake(true);
110
+        file.setAutomake(true);
111
         initFile(forceDefault);
111
         initFile(forceDefault);
112
         myTarget = getTarget(forceDefault);
112
         myTarget = getTarget(forceDefault);
113
     }
113
     }
123
             final ConfigFile configFile, final ConfigTarget target) {
123
             final ConfigFile configFile, final ConfigTarget target) {
124
         this.identityManager = identityManager;
124
         this.identityManager = identityManager;
125
         this.file = configFile;
125
         this.file = configFile;
126
-        this.file.setAutomake(true);
126
+        file.setAutomake(true);
127
         this.myTarget = target;
127
         this.myTarget = target;
128
     }
128
     }
129
 
129
 
181
     private void initFile(final boolean forceDefault)
181
     private void initFile(final boolean forceDefault)
182
             throws InvalidIdentityFileException, IOException {
182
             throws InvalidIdentityFileException, IOException {
183
         try {
183
         try {
184
-            this.file.read();
184
+            file.read();
185
         } catch (InvalidConfigFileException ex) {
185
         } catch (InvalidConfigFileException ex) {
186
             throw new InvalidIdentityFileException(ex);
186
             throw new InvalidIdentityFileException(ex);
187
         }
187
         }

+ 3
- 3
src/com/dmdirc/config/prefs/PreferencesSetting.java View File

33
 import java.util.Collection;
33
 import java.util.Collection;
34
 import java.util.HashMap;
34
 import java.util.HashMap;
35
 import java.util.Map;
35
 import java.util.Map;
36
+import java.util.Objects;
36
 
37
 
37
 /**
38
 /**
38
  * Represents a single setting.
39
  * Represents a single setting.
315
      * Dismisses changes to this setting.
316
      * Dismisses changes to this setting.
316
      */
317
      */
317
     public void dismiss() {
318
     public void dismiss() {
318
-        if (original != null && original.equals(value)
319
-                || original == null && value == null) {
319
+        if (Objects.equals(original, value)) {
320
             return;
320
             return;
321
         }
321
         }
322
 
322
 
333
      * @return true iif the setting will be changed if saved
333
      * @return true iif the setting will be changed if saved
334
      */
334
      */
335
     public boolean needsSaving() {
335
     public boolean needsSaving() {
336
-        return (value == null || !value.equals(original))
336
+        return (!Objects.equals(value, original))
337
                 && (value != null || original != null)
337
                 && (value != null || original != null)
338
                 && (validator == null || !validator.validate(value).isFailure());
338
                 && (validator == null || !validator.validate(value).isFailure());
339
     }
339
     }

+ 0
- 1
src/com/dmdirc/interfaces/Connection.java View File

32
 
32
 
33
 import java.net.URI;
33
 import java.net.URI;
34
 import java.util.Collection;
34
 import java.util.Collection;
35
-import java.util.Date;
36
 import java.util.Optional;
35
 import java.util.Optional;
37
 
36
 
38
 import javax.annotation.Nonnull;
37
 import javax.annotation.Nonnull;

+ 3
- 8
src/com/dmdirc/ui/core/about/CoreAboutDialogModel.java View File

22
 
22
 
23
 package com.dmdirc.ui.core.about;
23
 package com.dmdirc.ui.core.about;
24
 
24
 
25
-import com.dmdirc.ClientModule.GlobalConfig;
26
 import com.dmdirc.DMDircMBassador;
25
 import com.dmdirc.DMDircMBassador;
27
-import com.dmdirc.commandline.CommandLineOptionsModule;
28
 import com.dmdirc.commandline.CommandLineOptionsModule.Directory;
26
 import com.dmdirc.commandline.CommandLineOptionsModule.Directory;
27
+import com.dmdirc.commandline.CommandLineOptionsModule.DirectoryType;
29
 import com.dmdirc.commandline.CommandLineParser;
28
 import com.dmdirc.commandline.CommandLineParser;
30
 import com.dmdirc.events.ClientInfoRequestEvent;
29
 import com.dmdirc.events.ClientInfoRequestEvent;
31
-import com.dmdirc.interfaces.config.AggregateConfigProvider;
32
 import com.dmdirc.interfaces.ui.AboutDialogModel;
30
 import com.dmdirc.interfaces.ui.AboutDialogModel;
33
 import com.dmdirc.plugins.PluginManager;
31
 import com.dmdirc.plugins.PluginManager;
34
 import com.dmdirc.util.ClientInfo;
32
 import com.dmdirc.util.ClientInfo;
56
 public class CoreAboutDialogModel implements AboutDialogModel {
54
 public class CoreAboutDialogModel implements AboutDialogModel {
57
 
55
 
58
     private static final Logger LOGGER = LoggerFactory.getLogger(CoreAboutDialogModel.class);
56
     private static final Logger LOGGER = LoggerFactory.getLogger(CoreAboutDialogModel.class);
59
-    private final AggregateConfigProvider globalConfig;
60
     private final Path baseDirectory;
57
     private final Path baseDirectory;
61
     private final ClientInfo clientInfo;
58
     private final ClientInfo clientInfo;
62
     private final DMDircMBassador eventBus;
59
     private final DMDircMBassador eventBus;
63
     private final PluginManager pluginManager;
60
     private final PluginManager pluginManager;
61
+    private final CommandLineParser commandLineParser;
64
     private String about;
62
     private String about;
65
     private List<Developer> mainDevelopers;
63
     private List<Developer> mainDevelopers;
66
     private List<Developer> otherDevelopers;
64
     private List<Developer> otherDevelopers;
67
     private List<InfoItem> info;
65
     private List<InfoItem> info;
68
     private List<LicensedComponent> licences;
66
     private List<LicensedComponent> licences;
69
-    private CommandLineParser commandLineParser;
70
 
67
 
71
     @Inject
68
     @Inject
72
-    public CoreAboutDialogModel(@GlobalConfig final AggregateConfigProvider globalConfig,
73
-            @Directory(CommandLineOptionsModule.DirectoryType.BASE) final Path baseDirectory,
69
+    public CoreAboutDialogModel(@Directory(DirectoryType.BASE) final Path baseDirectory,
74
             final ClientInfo clientInfo, final DMDircMBassador eventBus,
70
             final ClientInfo clientInfo, final DMDircMBassador eventBus,
75
             final PluginManager pluginManager, final CommandLineParser commandLineParser) {
71
             final PluginManager pluginManager, final CommandLineParser commandLineParser) {
76
-        this.globalConfig = globalConfig;
77
         this.baseDirectory = baseDirectory;
72
         this.baseDirectory = baseDirectory;
78
         this.clientInfo = clientInfo;
73
         this.clientInfo = clientInfo;
79
         this.eventBus = eventBus;
74
         this.eventBus = eventBus;

+ 2
- 2
src/com/dmdirc/ui/core/aliases/CoreAliasDialogModel.java View File

148
         final Alias alias = aliases.get(name);
148
         final Alias alias = aliases.get(name);
149
         aliases.remove(name);
149
         aliases.remove(name);
150
         if (getSelectedAlias().isPresent() && getSelectedAlias().get().equals(alias)) {
150
         if (getSelectedAlias().isPresent() && getSelectedAlias().get().equals(alias)) {
151
-            setSelectedAlias(Optional.<Alias>empty());
151
+            setSelectedAlias(Optional.empty());
152
         }
152
         }
153
         listeners.getCallable(AliasDialogModelListener.class).aliasRemoved(alias);
153
         listeners.getCallable(AliasDialogModelListener.class).aliasRemoved(alias);
154
     }
154
     }
155
 
155
 
156
     @Override
156
     @Override
157
     public void save() {
157
     public void save() {
158
-        setSelectedAlias(Optional.<Alias>empty());
158
+        setSelectedAlias(Optional.empty());
159
         aliasManager.getAliases().forEach(aliasManager::removeAlias);
159
         aliasManager.getAliases().forEach(aliasManager::removeAlias);
160
         aliases.values().forEach(aliasManager::addAlias);
160
         aliases.values().forEach(aliasManager::addAlias);
161
     }
161
     }

+ 7
- 7
src/com/dmdirc/ui/messages/Formatter.java View File

66
 
66
 
67
         final String res = config.hasOptionString("formatter", messageType)
67
         final String res = config.hasOptionString("formatter", messageType)
68
                 ? config.getOption("formatter", messageType).replace("%-1$", "%"
68
                 ? config.getOption("formatter", messageType).replace("%-1$", "%"
69
-                        + arguments.length + "$") : null;
69
+                        + arguments.length + '$') : null;
70
 
70
 
71
         if (res == null) {
71
         if (res == null) {
72
-            return "<No format string for message type " + messageType + ">";
72
+            return "<No format string for message type " + messageType + '>';
73
         } else {
73
         } else {
74
             try {
74
             try {
75
                 final Object[] newArgs = castArguments(res, arguments);
75
                 final Object[] newArgs = castArguments(res, arguments);
76
                 return String.format(res.replaceAll("(%[0-9]+\\$)u", "$1s"), newArgs);
76
                 return String.format(res.replaceAll("(%[0-9]+\\$)u", "$1s"), newArgs);
77
             } catch (IllegalFormatConversionException ex) {
77
             } catch (IllegalFormatConversionException ex) {
78
                 return "<Invalid format string for message type " + messageType
78
                 return "<Invalid format string for message type " + messageType
79
-                        + "; Error: Illegal format conversion: " + ex.getMessage() + ">";
79
+                        + "; Error: Illegal format conversion: " + ex.getMessage() + '>';
80
             } catch (UnknownFormatConversionException ex) {
80
             } catch (UnknownFormatConversionException ex) {
81
                 return "<Invalid format string for message type " + messageType
81
                 return "<Invalid format string for message type " + messageType
82
-                        + "; Error: Unknown format conversion: " + ex.getMessage() + ">";
82
+                        + "; Error: Unknown format conversion: " + ex.getMessage() + '>';
83
             } catch (MissingFormatArgumentException ex) {
83
             } catch (MissingFormatArgumentException ex) {
84
                 return "<Invalid format string for message type " + messageType
84
                 return "<Invalid format string for message type " + messageType
85
-                        + "; Error: Missing format argument: " + ex.getMessage() + ">";
85
+                        + "; Error: Missing format argument: " + ex.getMessage() + '>';
86
             } catch (NumberFormatException ex) {
86
             } catch (NumberFormatException ex) {
87
                 return "<Invalid format string for message type " + messageType
87
                 return "<Invalid format string for message type " + messageType
88
-                        + "; Error: Invalid number conversion: " + ex.getMessage() + ">";
88
+                        + "; Error: Invalid number conversion: " + ex.getMessage() + '>';
89
             }
89
             }
90
         }
90
         }
91
     }
91
     }
181
         final Character[] types = new Character[args.length];
181
         final Character[] types = new Character[args.length];
182
 
182
 
183
         for (int i = 0; i < args.length; i++) {
183
         for (int i = 0; i < args.length; i++) {
184
-            final int index = format.indexOf("%" + (i + 1) + "$");
184
+            final int index = format.indexOf("%" + (i + 1) + '$');
185
 
185
 
186
             if (index > -1) {
186
             if (index > -1) {
187
                 types[i] = format.charAt(index + 3);
187
                 types[i] = format.charAt(index + 3);

+ 2
- 2
src/com/dmdirc/ui/messages/IRCTextAttribute.java View File

45
      */
45
      */
46
     protected IRCTextAttribute(final String name) {
46
     protected IRCTextAttribute(final String name) {
47
         super(name);
47
         super(name);
48
-        if (this.getClass() == IRCTextAttribute.class) {
48
+        if (getClass() == IRCTextAttribute.class) {
49
             INSTANCE_MAP.put(name, this);
49
             INSTANCE_MAP.put(name, this);
50
         }
50
         }
51
     }
51
     }
60
      */
60
      */
61
     @Override
61
     @Override
62
     protected Object readResolve() throws InvalidObjectException {
62
     protected Object readResolve() throws InvalidObjectException {
63
-        if (this.getClass() != IRCTextAttribute.class) {
63
+        if (getClass() != IRCTextAttribute.class) {
64
             throw new InvalidObjectException("subclass didn't correctly implement readResolve");
64
             throw new InvalidObjectException("subclass didn't correctly implement readResolve");
65
         }
65
         }
66
 
66
 

+ 6
- 6
src/com/dmdirc/updater/Version.java View File

74
 
74
 
75
     @Override
75
     @Override
76
     public int compareTo(@Nonnull final Version o) {
76
     public int compareTo(@Nonnull final Version o) {
77
-        if (o.intVersion > Integer.MIN_VALUE && this.intVersion > Integer.MIN_VALUE) {
78
-            return this.intVersion - o.intVersion;
79
-        } else if (o.strVersion == null && this.strVersion == null) {
77
+        if (o.intVersion > Integer.MIN_VALUE && intVersion > Integer.MIN_VALUE) {
78
+            return intVersion - o.intVersion;
79
+        } else if (o.strVersion == null && strVersion == null) {
80
             return 0;
80
             return 0;
81
-        } else if (o.strVersion == null && this.strVersion != null) {
81
+        } else if (o.strVersion == null && strVersion != null) {
82
             return 1;
82
             return 1;
83
-        } else if (o.strVersion != null && this.strVersion == null) {
83
+        } else if (o.strVersion != null && strVersion == null) {
84
             return -1;
84
             return -1;
85
         } else {
85
         } else {
86
-            final String[] myParts = this.strVersion.split("-");
86
+            final String[] myParts = strVersion.split("-");
87
             final String[] thParts = o.strVersion.split("-");
87
             final String[] thParts = o.strVersion.split("-");
88
 
88
 
89
             final String[] myFirstParts = myParts[0].split("\\.|(?=a|b|rc|m)");
89
             final String[] myFirstParts = myParts[0].split("\\.|(?=a|b|rc|m)");

+ 4
- 7
src/com/dmdirc/updater/manager/DMDircUpdateManager.java View File

70
                 new LinkedBlockingQueue<>(), new NamedThreadFactory()),
70
                 new LinkedBlockingQueue<>(), new NamedThreadFactory()),
71
                 consolidator, updatePolicy);
71
                 consolidator, updatePolicy);
72
 
72
 
73
-        checkStrategies.forEach(DMDircUpdateManager.this::addCheckStrategy);
74
-
75
-        retrievalStrategies.forEach(DMDircUpdateManager.this::addRetrievalStrategy);
76
-
77
-        installationStrategies.forEach(DMDircUpdateManager.this::addInstallationStrategy);
78
-
79
-        components.forEach(DMDircUpdateManager.this::addComponent);
73
+        checkStrategies.forEach(this::addCheckStrategy);
74
+        retrievalStrategies.forEach(this::addRetrievalStrategy);
75
+        installationStrategies.forEach(this::addInstallationStrategy);
76
+        components.forEach(this::addComponent);
80
     }
77
     }
81
 
78
 
82
     /**
79
     /**

+ 8
- 8
src/com/dmdirc/updater/manager/UpdateManagerImpl.java View File

97
     @Override
97
     @Override
98
     public void addCheckStrategy(final UpdateCheckStrategy strategy) {
98
     public void addCheckStrategy(final UpdateCheckStrategy strategy) {
99
         LOG.trace("Adding new check strategy: {}", strategy);
99
         LOG.trace("Adding new check strategy: {}", strategy);
100
-        this.checkers.add(strategy);
100
+        checkers.add(strategy);
101
     }
101
     }
102
 
102
 
103
     @Override
103
     @Override
104
     public void addRetrievalStrategy(final UpdateRetrievalStrategy strategy) {
104
     public void addRetrievalStrategy(final UpdateRetrievalStrategy strategy) {
105
         LOG.trace("Adding new retrieval strategy: {}", strategy);
105
         LOG.trace("Adding new retrieval strategy: {}", strategy);
106
         strategy.addUpdateRetrievalListener(retrievalListener);
106
         strategy.addUpdateRetrievalListener(retrievalListener);
107
-        this.retrievers.add(strategy);
107
+        retrievers.add(strategy);
108
     }
108
     }
109
 
109
 
110
     @Override
110
     @Override
111
     public void addInstallationStrategy(final UpdateInstallationStrategy strategy) {
111
     public void addInstallationStrategy(final UpdateInstallationStrategy strategy) {
112
         LOG.trace("Adding new installation strategy: {}", strategy);
112
         LOG.trace("Adding new installation strategy: {}", strategy);
113
         strategy.addUpdateInstallationListener(installationListener);
113
         strategy.addUpdateInstallationListener(installationListener);
114
-        this.installers.add(strategy);
114
+        installers.add(strategy);
115
     }
115
     }
116
 
116
 
117
     @Override
117
     @Override
118
     public void addComponent(final UpdateComponent component) {
118
     public void addComponent(final UpdateComponent component) {
119
         LOG.trace("Adding new component: {}", component);
119
         LOG.trace("Adding new component: {}", component);
120
         synchronized (componentsLock) {
120
         synchronized (componentsLock) {
121
-            this.components.put(component.getName(), component);
121
+            components.put(component.getName(), component);
122
         }
122
         }
123
     }
123
     }
124
 
124
 
126
     public void removeComponent(final UpdateComponent component) {
126
     public void removeComponent(final UpdateComponent component) {
127
         LOG.trace("Removing component: {}", component);
127
         LOG.trace("Removing component: {}", component);
128
         synchronized (componentsLock) {
128
         synchronized (componentsLock) {
129
-            this.components.remove(component.getName());
129
+            components.remove(component.getName());
130
         }
130
         }
131
 
131
 
132
-        this.checkResults.remove(component);
133
-        this.retrievalResults.remove(component);
132
+        checkResults.remove(component);
133
+        retrievalResults.remove(component);
134
     }
134
     }
135
 
135
 
136
     @Override
136
     @Override
137
     public Collection<UpdateComponent> getComponents() {
137
     public Collection<UpdateComponent> getComponents() {
138
         synchronized (componentsLock) {
138
         synchronized (componentsLock) {
139
-            return Collections.unmodifiableCollection(this.components.values());
139
+            return Collections.unmodifiableCollection(components.values());
140
         }
140
         }
141
     }
141
     }
142
 
142
 

+ 2
- 2
src/com/dmdirc/util/resourcemanager/ResourceManager.java View File

90
         } else if (url.startsWith("jar://") || url.startsWith("zip://")) {
90
         } else if (url.startsWith("jar://") || url.startsWith("zip://")) {
91
             return new ZipResourceManager(url.substring(6));
91
             return new ZipResourceManager(url.substring(6));
92
         } else {
92
         } else {
93
-            throw new IllegalArgumentException("Unknown resource manager type (" + url + ")");
93
+            throw new IllegalArgumentException("Unknown resource manager type (" + url + ')');
94
         }
94
         }
95
     }
95
     }
96
 
96
 
134
 
134
 
135
         if (usePath && resourceName.indexOf('/') > -1) {
135
         if (usePath && resourceName.indexOf('/') > -1) {
136
             newDir = new File(directory,
136
             newDir = new File(directory,
137
-                    resourceName.substring(0, resourceName.lastIndexOf('/')) + "/");
137
+                    resourceName.substring(0, resourceName.lastIndexOf('/')) + '/');
138
         } else {
138
         } else {
139
             newDir = new File(directory);
139
             newDir = new File(directory);
140
         }
140
         }

+ 2
- 2
src/com/dmdirc/util/resourcemanager/ZipResourceManager.java View File

146
     @Override
146
     @Override
147
     public URL getResourceURL(final String resource) throws MalformedURLException {
147
     public URL getResourceURL(final String resource) throws MalformedURLException {
148
         if (resourceExists(resource)) {
148
         if (resourceExists(resource)) {
149
-            return new URL("jar:file:/" + zipFile.getName() + "!"
150
-                    + (resource.charAt(0) == '/' ? resource : "/" + resource));
149
+            return new URL("jar:file:/" + zipFile.getName() + '!'
150
+                    + (resource.charAt(0) == '/' ? resource : '/' + resource));
151
         } else {
151
         } else {
152
             return null;
152
             return null;
153
         }
153
         }

+ 2
- 5
test/com/dmdirc/ui/core/about/CoreAboutDialogModelTest.java View File

24
 
24
 
25
 import com.dmdirc.DMDircMBassador;
25
 import com.dmdirc.DMDircMBassador;
26
 import com.dmdirc.commandline.CommandLineParser;
26
 import com.dmdirc.commandline.CommandLineParser;
27
-import com.dmdirc.interfaces.config.AggregateConfigProvider;
28
 import com.dmdirc.plugins.PluginInfo;
27
 import com.dmdirc.plugins.PluginInfo;
29
 import com.dmdirc.plugins.PluginManager;
28
 import com.dmdirc.plugins.PluginManager;
30
 import com.dmdirc.plugins.PluginMetaData;
29
 import com.dmdirc.plugins.PluginMetaData;
51
 public class CoreAboutDialogModelTest {
50
 public class CoreAboutDialogModelTest {
52
 
51
 
53
     @Mock private ClientInfo clientInfo;
52
     @Mock private ClientInfo clientInfo;
54
-    @Mock private AggregateConfigProvider globalConfig;
55
     @Mock private Path path;
53
     @Mock private Path path;
56
     @Mock private DMDircMBassador eventBus;
54
     @Mock private DMDircMBassador eventBus;
57
     @Mock private PluginManager pluginManager;
55
     @Mock private PluginManager pluginManager;
69
         when(clientInfo.getVersionInformation()).thenReturn("DMDirc Version");
67
         when(clientInfo.getVersionInformation()).thenReturn("DMDirc Version");
70
         when(clientInfo.getOperatingSystemInformation()).thenReturn("OS Version");
68
         when(clientInfo.getOperatingSystemInformation()).thenReturn("OS Version");
71
         when(clientInfo.getJavaInformation()).thenReturn("Java Version");
69
         when(clientInfo.getJavaInformation()).thenReturn("Java Version");
72
-        when(globalConfig.getOption("identity", "modealiasversion")).thenReturn("ModeAlias Version");
73
         when(pluginManager.getPluginInfos()).thenReturn(Lists.newArrayList(pluginInfo1, pluginInfo2));
70
         when(pluginManager.getPluginInfos()).thenReturn(Lists.newArrayList(pluginInfo1, pluginInfo2));
74
         when(pluginInfo1.getPath("/META-INF/licences/")).thenReturn(pluginPath1);
71
         when(pluginInfo1.getPath("/META-INF/licences/")).thenReturn(pluginPath1);
75
         when(pluginInfo2.getPath("/META-INF/licences/")).thenReturn(pluginPath2);
72
         when(pluginInfo2.getPath("/META-INF/licences/")).thenReturn(pluginPath2);
78
         when(pluginMetaData1.getFriendlyName()).thenReturn("Plugin1");
75
         when(pluginMetaData1.getFriendlyName()).thenReturn("Plugin1");
79
         when(pluginMetaData2.getFriendlyName()).thenReturn("Plugin2");
76
         when(pluginMetaData2.getFriendlyName()).thenReturn("Plugin2");
80
         when(commandLineParser.getLauncherVersion()).thenReturn(Optional.of("Unknown"));
77
         when(commandLineParser.getLauncherVersion()).thenReturn(Optional.of("Unknown"));
81
-        instance = new CoreAboutDialogModel(globalConfig, path, clientInfo, eventBus,
82
-                pluginManager, commandLineParser);
78
+        instance = new CoreAboutDialogModel(path, clientInfo, eventBus, pluginManager,
79
+                commandLineParser);
83
         instance.load();
80
         instance.load();
84
     }
81
     }
85
 
82
 

Loading…
Cancel
Save