Set<String> bucket = new HashSet<>();
try {
Enumeration<URL> urls = getClass().getClassLoader().getResources(getExtensionsResource());
- collectExtensions(urls, bucket);
+ if (urls.hasMoreElements()) {
+ collectExtensions(urls, bucket);
+ } else {
+ log.debug("Cannot find '{}'", getExtensionsResource());
+ }
debugExtensions(bucket);
final Set<String> bucket = new HashSet<>();
try {
- URL url = getClass().getClassLoader().getResource(getExtensionsResource());
- if (url != null) {
- collectExtensions(url, bucket);
+ Enumeration<URL> urls = getClass().getClassLoader().getResources(getExtensionsResource());
+ if (urls.hasMoreElements()) {
+ collectExtensions(urls, bucket);
+ } else {
+ log.debug("Cannot find '{}'", getExtensionsResource());
}
debugExtensions(bucket);
try {
Enumeration<URL> urls = ((PluginClassLoader) plugin.getPluginClassLoader()).findResources(getExtensionsResource());
if (urls.hasMoreElements()) {
- while (urls.hasMoreElements()) {
- URL url = urls.nextElement();
- collectExtensions(url, bucket);
- }
+ collectExtensions(urls, bucket);
} else {
log.debug("Cannot find '{}'", getExtensionsResource());
}
return result;
}
+ private void collectExtensions(Enumeration<URL> urls, Set<String> bucket) throws URISyntaxException, IOException {
+ while (urls.hasMoreElements()) {
+ URL url = urls.nextElement();
+ log.debug("Read '{}'", url.getFile());
+ collectExtensions(url, bucket);
+ }
+ }
+
private void collectExtensions(URL url, Set<String> bucket) throws URISyntaxException, IOException {
Path extensionPath;
if (url.toURI().getScheme().equals("jar")) {