aboutsummaryrefslogtreecommitdiffstats
path: root/pf4j
diff options
context:
space:
mode:
authorDecebal Suiu <decebal.suiu@gmail.com>2016-01-05 15:21:52 +0200
committerDecebal Suiu <decebal.suiu@gmail.com>2016-01-05 15:21:52 +0200
commitec60800452476fd9019e6eabd3d20b1bdb5528ca (patch)
tree07d6aec77977855196b90e1b2f12a18cd45329de /pf4j
parent6533d2258c5987d8a042625bb21a8ee766f9a8f6 (diff)
downloadpf4j-ec60800452476fd9019e6eabd3d20b1bdb5528ca.tar.gz
pf4j-ec60800452476fd9019e6eabd3d20b1bdb5528ca.zip
Use PluginClassLoader.findResource instead of getResource
Diffstat (limited to 'pf4j')
-rw-r--r--pf4j/src/main/java/ro/fortsoft/pf4j/LegacyExtensionFinder.java4
-rw-r--r--pf4j/src/main/java/ro/fortsoft/pf4j/PluginClassLoader.java5
-rw-r--r--pf4j/src/main/java/ro/fortsoft/pf4j/ServiceProviderExtensionFinder.java4
3 files changed, 7 insertions, 6 deletions
diff --git a/pf4j/src/main/java/ro/fortsoft/pf4j/LegacyExtensionFinder.java b/pf4j/src/main/java/ro/fortsoft/pf4j/LegacyExtensionFinder.java
index 4937cda..03a6bab 100644
--- a/pf4j/src/main/java/ro/fortsoft/pf4j/LegacyExtensionFinder.java
+++ b/pf4j/src/main/java/ro/fortsoft/pf4j/LegacyExtensionFinder.java
@@ -47,7 +47,6 @@ public class LegacyExtensionFinder extends AbstractExtensionFinder {
@Override
public Map<String, Set<String>> readClasspathStorages() {
log.debug("Reading extensions storages from classpath");
-
Map<String, Set<String>> result = new LinkedHashMap<>();
Set<String> bucket = new HashSet<>();
@@ -80,7 +79,6 @@ public class LegacyExtensionFinder extends AbstractExtensionFinder {
@Override
public Map<String, Set<String>> readPluginsStorages() {
log.debug("Reading extensions storages from plugins");
-
Map<String, Set<String>> result = new LinkedHashMap<>();
List<PluginWrapper> plugins = pluginManager.getPlugins();
@@ -90,7 +88,7 @@ public class LegacyExtensionFinder extends AbstractExtensionFinder {
Set<String> bucket = new HashSet<>();
try {
- URL url = plugin.getPluginClassLoader().getResource(getExtensionsResource());
+ URL url = ((PluginClassLoader) plugin.getPluginClassLoader()).findResource(getExtensionsResource());
if (url != null) {
log.debug("Read '{}'", url.getFile());
Reader reader = new InputStreamReader(url.openStream(), "UTF-8");
diff --git a/pf4j/src/main/java/ro/fortsoft/pf4j/PluginClassLoader.java b/pf4j/src/main/java/ro/fortsoft/pf4j/PluginClassLoader.java
index c2f81df..b231ffd 100644
--- a/pf4j/src/main/java/ro/fortsoft/pf4j/PluginClassLoader.java
+++ b/pf4j/src/main/java/ro/fortsoft/pf4j/PluginClassLoader.java
@@ -129,6 +129,11 @@ public class PluginClassLoader extends URLClassLoader {
return super.getResource(name);
}
+ @Override
+ public URL findResource(String name) {
+ return super.findResource(name);
+ }
+
/**
* Release all resources acquired by this class loader.
* The current implementation is incomplete.
diff --git a/pf4j/src/main/java/ro/fortsoft/pf4j/ServiceProviderExtensionFinder.java b/pf4j/src/main/java/ro/fortsoft/pf4j/ServiceProviderExtensionFinder.java
index e6501eb..05c9cb4 100644
--- a/pf4j/src/main/java/ro/fortsoft/pf4j/ServiceProviderExtensionFinder.java
+++ b/pf4j/src/main/java/ro/fortsoft/pf4j/ServiceProviderExtensionFinder.java
@@ -48,7 +48,6 @@ public class ServiceProviderExtensionFinder extends AbstractExtensionFinder {
@Override
public Map<String, Set<String>> readClasspathStorages() {
log.debug("Reading extensions storages from classpath");
-
Map<String, Set<String>> result = new LinkedHashMap<>();
Set<String> bucket = new HashSet<>();
@@ -85,7 +84,6 @@ public class ServiceProviderExtensionFinder extends AbstractExtensionFinder {
@Override
public Map<String, Set<String>> readPluginsStorages() {
log.debug("Reading extensions storages from plugins");
-
Map<String, Set<String>> result = new LinkedHashMap<>();
List<PluginWrapper> plugins = pluginManager.getPlugins();
@@ -95,7 +93,7 @@ public class ServiceProviderExtensionFinder extends AbstractExtensionFinder {
Set<String> bucket = new HashSet<>();
try {
- URL url = plugin.getPluginClassLoader().getResource(getExtensionsResource());
+ URL url = ((PluginClassLoader) plugin.getPluginClassLoader()).findResource(getExtensionsResource());
if (url != null) {
File[] files = new File(url.toURI()).listFiles();
if (files != null) {