mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-22 00:05:31 +00:00
bug fix in loading dependency class.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@2317 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
75156c3e37
commit
e4de4f5139
3 files changed
+10
-9
No files matched your search
@@ -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
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user