Преглед на файлове

Fix failures.

pull/420/head
Greg Holmes преди 9 години
родител
ревизия
03067179f2

+ 7
- 11
mediasource_linux_title/src/com/dmdirc/addons/mediasource_linux_title/TitleMediaSourceManager.java Целия файл

@@ -22,10 +22,10 @@
22 22
 
23 23
 package com.dmdirc.addons.mediasource_linux_title;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26 25
 import com.dmdirc.addons.nowplaying.MediaSource;
27 26
 
28 27
 import java.util.ArrayList;
28
+import java.util.Collections;
29 29
 import java.util.List;
30 30
 
31 31
 import javax.inject.Inject;
@@ -37,31 +37,27 @@ import javax.inject.Inject;
37 37
 public class TitleMediaSourceManager {
38 38
 
39 39
     /** The sources to be returned. */
40
-    private List<MediaSource> sources = null;
41
-    /** The event bus to post errors to. */
42
-    private final DMDircMBassador eventBus;
40
+    private final List<MediaSource> sources;
43 41
 
44 42
     @Inject
45
-    public TitleMediaSourceManager(final DMDircMBassador eventBus) {
46
-        this.eventBus = eventBus;
43
+    public TitleMediaSourceManager() {
44
+        sources = new ArrayList<>(2);
47 45
     }
48 46
 
49 47
     public void onLoad() {
50
-        sources = new ArrayList<>(2);
51
-        sources.add(new TitleMediaSource(eventBus, "grep -E '\\(\"last\\.?fm\" \"Last\\.?fm\"\\)'"
48
+        sources.add(new TitleMediaSource("grep -E '\\(\"last\\.?fm\" \"Last\\.?fm\"\\)'"
52 49
                 + "| grep -vE '(\"Last.fm "
53 50
                 + "Options\"|\"Diagnostics\"|\"last\\.?fm\"|\"Share\"|\\(has no "
54 51
                 + "name\\)):' | sed -r 's/^[^\"]*?\"(.*)\": \\(\"last\\.?fm.*$/\\1/g'", "Last.fm"));
55
-        sources.add(new TitleMediaSource(eventBus, "grep '\": (\"spotify.exe' | cut -d '\"' -f 2 | "
52
+        sources.add(new TitleMediaSource("grep '\": (\"spotify.exe' | cut -d '\"' -f 2 | "
56 53
                 + "cut -d '-' -f 2- | sed -r 's/^\\s+|\\s+$//g' | sed -r 's/-/–/g'", "Spotify"));
57 54
     }
58 55
 
59 56
     public void onUnload() {
60 57
         sources.clear();
61
-        sources = null;
62 58
     }
63 59
 
64 60
     public List<MediaSource> getSources() {
65
-        return sources;
61
+        return Collections.unmodifiableList(sources);
66 62
     }
67 63
 }

+ 4
- 12
scriptplugin/src/com/dmdirc/addons/scriptplugin/ScriptCommand.java Целия файл

@@ -23,7 +23,6 @@
23 23
 package com.dmdirc.addons.scriptplugin;
24 24
 
25 25
 import com.dmdirc.ClientModule.GlobalConfig;
26
-import com.dmdirc.DMDircMBassador;
27 26
 import com.dmdirc.commandline.CommandLineOptionsModule.Directory;
28 27
 import com.dmdirc.commandparser.BaseCommandInfo;
29 28
 import com.dmdirc.commandparser.CommandArguments;
@@ -39,7 +38,6 @@ import com.dmdirc.plugins.PluginDomain;
39 38
 import com.dmdirc.ui.input.AdditionalTabTargets;
40 39
 
41 40
 import java.io.File;
42
-import java.io.FileNotFoundException;
43 41
 import java.io.FileWriter;
44 42
 import java.io.IOException;
45 43
 import java.util.Map;
@@ -68,14 +66,11 @@ public class ScriptCommand extends Command implements IntelligentCommand {
68 66
     private final String scriptDirectory;
69 67
     /** Script manager to handle scripts. */
70 68
     private final ScriptManager scriptManager;
71
-    /** The event bus to post errors to. */
72
-    private final DMDircMBassador eventBus;
73 69
 
74 70
     /**
75 71
      * Creates a new instance of this command.
76 72
      *
77 73
      * @param scriptManager       Used to manage scripts
78
-     * @param eventBus            The event bus to post errors to
79 74
      * @param globalConfig        Global config
80 75
      * @param commandController   The controller to use for command information.
81 76
      * @param domain              This plugin's settings domain
@@ -84,7 +79,6 @@ public class ScriptCommand extends Command implements IntelligentCommand {
84 79
      */
85 80
     @Inject
86 81
     public ScriptCommand(final ScriptManager scriptManager,
87
-            final DMDircMBassador eventBus,
88 82
             @Directory(ScriptModule.SCRIPTS) final String scriptDirectory,
89 83
             @GlobalConfig final AggregateConfigProvider globalConfig,
90 84
             final CommandController commandController,
@@ -96,7 +90,6 @@ public class ScriptCommand extends Command implements IntelligentCommand {
96 90
         this.scriptEngineManager = scriptEngineManager;
97 91
         this.scriptDirectory = scriptDirectory;
98 92
         this.scriptManager = scriptManager;
99
-        this.eventBus = eventBus;
100 93
     }
101 94
 
102 95
     @Override
@@ -135,20 +128,19 @@ public class ScriptCommand extends Command implements IntelligentCommand {
135 128
                         final String baseFile = scriptDirectory + '/'
136 129
                                 + globalConfig.getOption(domain, "eval.baseFile");
137 130
                         if (new File(baseFile).exists()) {
138
-                            wrapper = new ScriptEngineWrapper(scriptEngineManager, eventBus,
139
-                                    baseFile);
131
+                            wrapper = new ScriptEngineWrapper(scriptEngineManager, baseFile);
140 132
                         } else {
141
-                            wrapper = new ScriptEngineWrapper(scriptEngineManager, eventBus, null);
133
+                            wrapper = new ScriptEngineWrapper(scriptEngineManager, null);
142 134
                         }
143 135
                     } else {
144
-                        wrapper = new ScriptEngineWrapper(scriptEngineManager, eventBus, null);
136
+                        wrapper = new ScriptEngineWrapper(scriptEngineManager, null);
145 137
                     }
146 138
                     wrapper.getScriptEngine().put("cmd_origin", origin);
147 139
                     wrapper.getScriptEngine().put("cmd_isSilent", args.isSilent());
148 140
                     wrapper.getScriptEngine().put("cmd_args", sargs);
149 141
                     sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Result: " + wrapper.
150 142
                             getScriptEngine().eval(script));
151
-                } catch (FileNotFoundException | ScriptException e) {
143
+                } catch (ScriptException e) {
152 144
                     sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Exception: " + e + " -> " + e.
153 145
                             getMessage());
154 146
 

Loading…
Отказ
Запис