|
@@ -32,8 +32,6 @@ import com.google.common.collect.ArrayListMultimap;
|
32
|
32
|
import com.google.common.collect.Multimap;
|
33
|
33
|
|
34
|
34
|
import java.io.IOException;
|
35
|
|
-import java.net.MalformedURLException;
|
36
|
|
-import java.net.URL;
|
37
|
35
|
import java.nio.file.FileVisitOption;
|
38
|
36
|
import java.nio.file.Files;
|
39
|
37
|
import java.nio.file.Path;
|
|
@@ -41,12 +39,10 @@ import java.util.ArrayList;
|
41
|
39
|
import java.util.Collection;
|
42
|
40
|
import java.util.Collections;
|
43
|
41
|
import java.util.Map;
|
44
|
|
-import java.util.Objects;
|
45
|
42
|
import java.util.concurrent.CopyOnWriteArrayList;
|
46
|
43
|
import java.util.function.Function;
|
47
|
44
|
import java.util.stream.Collectors;
|
48
|
45
|
|
49
|
|
-import javax.annotation.Nullable;
|
50
|
46
|
import javax.inject.Inject;
|
51
|
47
|
import javax.inject.Singleton;
|
52
|
48
|
|
|
@@ -111,7 +107,6 @@ public class PluginFileHandler {
|
111
|
107
|
.filter(p -> p.getFileName().toString().endsWith(".jar"))
|
112
|
108
|
.map(Path::toAbsolutePath)
|
113
|
109
|
.map(path -> getMetaData(path, manager))
|
114
|
|
- .filter(Objects::nonNull)
|
115
|
110
|
.collect(Collectors.toList());
|
116
|
111
|
} catch (IOException ex) {
|
117
|
112
|
eventBus.publish(new UserErrorEvent(ErrorLevel.HIGH, ex,
|
|
@@ -125,20 +120,12 @@ public class PluginFileHandler {
|
125
|
120
|
*
|
126
|
121
|
* @param path The path of the plugin to get metadata from.
|
127
|
122
|
* @param manager The plugin manager to pass to new metadata instances.
|
128
|
|
- * @return The metadata if it could be created, {@code null} otherwise.
|
|
123
|
+ * @return The metadata for the given plugin.
|
129
|
124
|
*/
|
130
|
|
- @Nullable
|
131
|
125
|
private PluginMetaData getMetaData(final Path path, final PluginManager manager) {
|
132
|
|
- try {
|
133
|
|
- final PluginMetaData metaData = new PluginMetaData(
|
134
|
|
- manager, new URL("jar:file:" + path + "!/META-INF/plugin.config"), path);
|
135
|
|
- metaData.load();
|
136
|
|
- return metaData;
|
137
|
|
- } catch (MalformedURLException ex) {
|
138
|
|
- eventBus.publish(new UserErrorEvent(ErrorLevel.MEDIUM, ex,
|
139
|
|
- "Error creating URL for plugin " + path + ": " + ex.getMessage(), ""));
|
140
|
|
- return null;
|
141
|
|
- }
|
|
126
|
+ final PluginMetaData metaData = new PluginMetaData(manager, path);
|
|
127
|
+ metaData.load();
|
|
128
|
+ return metaData;
|
142
|
129
|
}
|
143
|
130
|
|
144
|
131
|
/**
|