diff options
author | Aleksandr Sidorov <117445585+etojesaandro@users.noreply.github.com> | 2024-06-29 22:30:03 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-29 22:30:03 +0300 |
commit | c6502786275ee53fdacee33ac35fc4d08faa7026 (patch) | |
tree | cbfac300d8df964c296c85ead4e845e739b9d765 /pf4j/src/main | |
parent | 2b556de60fadb263b9b40757d6e1fcc6f3363cb2 (diff) | |
download | pf4j-c6502786275ee53fdacee33ac35fc4d08faa7026.tar.gz pf4j-c6502786275ee53fdacee33ac35fc4d08faa7026.zip |
Plugin Extensions should be detected with any ClassLoadingStrategy (#586)
Diffstat (limited to 'pf4j/src/main')
-rw-r--r-- | pf4j/src/main/java/org/pf4j/PluginClassLoader.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/pf4j/src/main/java/org/pf4j/PluginClassLoader.java b/pf4j/src/main/java/org/pf4j/PluginClassLoader.java index d11e7b9..cf0608c 100644 --- a/pf4j/src/main/java/org/pf4j/PluginClassLoader.java +++ b/pf4j/src/main/java/org/pf4j/PluginClassLoader.java @@ -181,8 +181,9 @@ public class PluginClassLoader extends URLClassLoader { */ @Override public URL getResource(String name) { + ClassLoadingStrategy loadingStrategy = getClassLoadingStrategy(name); log.trace("Received request to load resource '{}'", name); - for (ClassLoadingStrategy.Source classLoadingSource : classLoadingStrategy.getSources()) { + for (ClassLoadingStrategy.Source classLoadingSource : loadingStrategy.getSources()) { URL url = null; switch (classLoadingSource) { case APPLICATION: @@ -210,9 +211,9 @@ public class PluginClassLoader extends URLClassLoader { @Override public Enumeration<URL> getResources(String name) throws IOException { List<URL> resources = new ArrayList<>(); - + ClassLoadingStrategy loadingStrategy = getClassLoadingStrategy(name); log.trace("Received request to load resources '{}'", name); - for (ClassLoadingStrategy.Source classLoadingSource : classLoadingStrategy.getSources()) { + for (ClassLoadingStrategy.Source classLoadingSource : loadingStrategy.getSources()) { switch (classLoadingSource) { case APPLICATION: if (getParent() != null) { @@ -231,6 +232,14 @@ public class PluginClassLoader extends URLClassLoader { return Collections.enumeration(resources); } + private ClassLoadingStrategy getClassLoadingStrategy(String name) { + ClassLoadingStrategy loadingStrategy = classLoadingStrategy; + if (LegacyExtensionFinder.EXTENSIONS_RESOURCE.equals(name)) { + loadingStrategy = ClassLoadingStrategy.PAD; + } + return loadingStrategy; + } + /** * Closes this class loader. * <p> |