diff --git a/core/pom.xml b/core/pom.xml
index a01d96b940b87bcb154af7970e2241d444ed3e3e..2a74e3d87ba0936e3bb718aa8fc9eb7c186c46f2 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -236,7 +236,7 @@
org.kohsuke.stapler
stapler
- 1.21
+ 1.22
antlr
diff --git a/core/src/main/java/hudson/PluginManager.java b/core/src/main/java/hudson/PluginManager.java
index 319c825a74a3b1ac0bb6388fafb5152a827c81e4..a23ee2899a173e8460f49e4d67ed108edd098565 100644
--- a/core/src/main/java/hudson/PluginManager.java
+++ b/core/src/main/java/hudson/PluginManager.java
@@ -71,7 +71,7 @@ public final class PluginManager {
}
for( File arc : archives ) {
try {
- PluginWrapper p = new PluginWrapper(this, arc);
+ PluginWrapper p = new PluginWrapper(this,arc);
plugins.add(p);
if(p.isActive())
activePlugins.add(p);
diff --git a/core/src/main/java/hudson/PluginWrapper.java b/core/src/main/java/hudson/PluginWrapper.java
index 6b089fbb5cdfeb288a777962812556bd731311c5..cf64ab356e32e179df49007e64d0a42229e15a40 100644
--- a/core/src/main/java/hudson/PluginWrapper.java
+++ b/core/src/main/java/hudson/PluginWrapper.java
@@ -1,6 +1,5 @@
package hudson;
-import hudson.model.Hudson;
import hudson.util.IOException2;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
@@ -114,7 +113,7 @@ public final class PluginWrapper {
* if an installation of this plugin failed. The caller should
* proceed to work with other plugins.
*/
- public PluginWrapper(File archive) throws IOException {
+ public PluginWrapper(PluginManager owner, File archive) throws IOException {
LOGGER.info("Loading plugin: "+archive);
this.archive = archive;
@@ -181,7 +180,7 @@ public final class PluginWrapper {
this.baseResourceURL = expandDir.toURL();
}
- ClassLoader dependencyLoader = new DependencyClassLoader(getClass().getClassLoader());
+ ClassLoader dependencyLoader = new DependencyClassLoader(getClass().getClassLoader(),owner);
this.classLoader = new URLClassLoader(paths.toArray(new URL[0]), dependencyLoader);
disableFile = new File(archive.getPath()+".disabled");
@@ -449,17 +448,19 @@ public final class PluginWrapper {
* Used to load classes from dependency plugins.
*/
final class DependencyClassLoader extends ClassLoader {
- public DependencyClassLoader(ClassLoader parent) {
+ private final PluginManager manager;
+
+ public DependencyClassLoader(ClassLoader parent, PluginManager manager) {
super(parent);
+ this.manager = manager;
}
protected Class> findClass(String name) throws ClassNotFoundException {
- PluginManager m = Hudson.getInstance().getPluginManager();
for (Dependency dep : dependencies) {
- PluginWrapper p = m.getPlugin(dep.shortName);
+ PluginWrapper p = manager.getPlugin(dep.shortName);
if(p!=null)
try {
- p.classLoader.loadClass(name);
+ return p.classLoader.loadClass(name);
} catch (ClassNotFoundException _) {
// try next
}