diff options
author | Decebal Suiu <decebal.suiu@gmail.com> | 2014-06-02 16:05:30 +0300 |
---|---|---|
committer | Decebal Suiu <decebal.suiu@gmail.com> | 2014-06-02 16:05:30 +0300 |
commit | f508484004b0d71bd146eadd0cb1f7de1db43952 (patch) | |
tree | 738d4ccae63cd8d6cdaf7ae4c16fe1050bef1ab0 /pf4j | |
parent | 441062e98cfa0539030ed3c74d3bd5baceaddf53 (diff) | |
download | pf4j-f508484004b0d71bd146eadd0cb1f7de1db43952.tar.gz pf4j-f508484004b0d71bd146eadd0cb1f7de1db43952.zip |
fix an issue that occurs when the plugin developer put the pf4j jar in the plugin's lib folder (or not declare the pf4j dependency with scope provided in pom.xml)
Diffstat (limited to 'pf4j')
-rw-r--r-- | pf4j/src/main/java/ro/fortsoft/pf4j/PluginClassLoader.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/pf4j/src/main/java/ro/fortsoft/pf4j/PluginClassLoader.java b/pf4j/src/main/java/ro/fortsoft/pf4j/PluginClassLoader.java index 5573703..055c163 100644 --- a/pf4j/src/main/java/ro/fortsoft/pf4j/PluginClassLoader.java +++ b/pf4j/src/main/java/ro/fortsoft/pf4j/PluginClassLoader.java @@ -60,6 +60,15 @@ public class PluginClassLoader extends URLClassLoader { } */ + // if the class it's a part of the plugin engine use parent class loader + if (className.startsWith(PLUGIN_PACKAGE_PREFIX)) { + try { + return PluginClassLoader.class.getClassLoader().loadClass(className); + } catch (ClassNotFoundException e) { + // try next step + } + } + // second check whether it's already been loaded Class<?> loadedClass = findLoadedClass(className); if (loadedClass != null) { @@ -73,15 +82,6 @@ public class PluginClassLoader extends URLClassLoader { // try next step } - // if the class it's a part of the plugin engine use parent class loader - if (className.startsWith(PLUGIN_PACKAGE_PREFIX)) { - try { - return PluginClassLoader.class.getClassLoader().loadClass(className); - } catch (ClassNotFoundException e) { - // try next step - } - } - // look in dependencies List<PluginDependency> dependencies = pluginDescriptor.getDependencies(); for (PluginDependency dependency : dependencies) { |