diff options
Diffstat (limited to 'pf4j/src/main/java/org')
-rw-r--r-- | pf4j/src/main/java/org/pf4j/PluginClassLoader.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pf4j/src/main/java/org/pf4j/PluginClassLoader.java b/pf4j/src/main/java/org/pf4j/PluginClassLoader.java index 022b61c..755921a 100644 --- a/pf4j/src/main/java/org/pf4j/PluginClassLoader.java +++ b/pf4j/src/main/java/org/pf4j/PluginClassLoader.java @@ -22,6 +22,9 @@ import java.io.File; import java.io.IOException; import java.net.URL; import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Enumeration; import java.util.List; /** @@ -189,6 +192,23 @@ public class PluginClassLoader extends URLClassLoader { } } + @Override + public Enumeration<URL> getResources(String name) throws IOException { + if (!parentFirst) { + List<URL> resources = new ArrayList<>(); + + resources.addAll(Collections.list(findResources(name))); + + if (getParent() != null) { + resources.addAll(Collections.list(getParent().getResources(name))); + } + + return Collections.enumeration(resources); + } else { + return super.getResources(name); + } + } + private Class<?> loadClassFromDependencies(String className) { log.trace("Search in dependencies for class '{}'", className); List<PluginDependency> dependencies = pluginDescriptor.getDependencies(); |