Set<String> bucket = new HashSet<>();
try {
- URL url = ((PluginClassLoader) plugin.getPluginClassLoader()).findResource(getExtensionsResource());
- if (url != null) {
- log.debug("Read '{}'", url.getFile());
- try (Reader reader = new InputStreamReader(url.openStream(), StandardCharsets.UTF_8)) {
- LegacyExtensionStorage.read(reader, bucket);
- }
- } else {
+ Enumeration<URL> urls = ((PluginClassLoader) plugin.getPluginClassLoader()).findResources(getExtensionsResource());
+ if (urls == null || !urls.hasMoreElements()) {
log.debug("Cannot find '{}'", getExtensionsResource());
+ } else {
+ while (urls.hasMoreElements()) {
+ URL url = urls.nextElement();
+ log.debug("Read '{}'", url.getFile());
+ try (Reader reader = new InputStreamReader(url.openStream(), StandardCharsets.UTF_8)) {
+ LegacyExtensionStorage.read(reader, bucket);
+ }
+ }
}
debugExtensions(bucket);
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Collections;
+import java.util.Enumeration;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
final Set<String> bucket = new HashSet<>();
try {
- URL url = ((PluginClassLoader) plugin.getPluginClassLoader()).findResource(getExtensionsResource());
- if (url != null) {
- Path extensionPath;
- if (url.toURI().getScheme().equals("jar")) {
- extensionPath = FileUtils.getPath(url.toURI(), getExtensionsResource());
- } else {
- extensionPath = Paths.get(url.toURI());
- }
-
- bucket.addAll(readExtensions(extensionPath));
- } else {
+ Enumeration<URL> urls = ((PluginClassLoader) plugin.getPluginClassLoader()).findResources(getExtensionsResource());
+ if (urls == null || !urls.hasMoreElements()) {
log.debug("Cannot find '{}'", getExtensionsResource());
+ } else {
+ while (urls.hasMoreElements()) {
+ URL url = urls.nextElement();
+ Path extensionPath;
+ if (url.toURI().getScheme().equals("jar")) {
+ extensionPath = FileUtils.getPath(url.toURI(), getExtensionsResource());
+ } else {
+ extensionPath = Paths.get(url.toURI());
+ }
+
+ bucket.addAll(readExtensions(extensionPath));
+ }
}
debugExtensions(bucket);