mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-17 22:12:25 +00:00
[FIXED HUDSON-4086] in 1.318.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@20118 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
8e0b5527b3
commit
344e27d39a
1 file changed
+12
-2
@@ -25,8 +25,10 @@ package hudson.util;
|
||||
|
||||
import groovy.lang.GroovyShell;
|
||||
import hudson.Functions;
|
||||
import hudson.model.Hudson;
|
||||
import hudson.remoting.Callable;
|
||||
import hudson.remoting.VirtualChannel;
|
||||
import hudson.remoting.DelegatingCallable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
@@ -94,15 +96,23 @@ public final class RemotingDiagnostics {
|
||||
return channel.call(new Script(script));
|
||||
}
|
||||
|
||||
private static final class Script implements Callable<String,RuntimeException> {
|
||||
private static final class Script implements DelegatingCallable<String,RuntimeException> {
|
||||
private final String script;
|
||||
private transient ClassLoader cl;
|
||||
|
||||
private Script(String script) {
|
||||
this.script = script;
|
||||
cl = getClassLoader();
|
||||
}
|
||||
|
||||
public ClassLoader getClassLoader() {
|
||||
return Hudson.getInstance().getPluginManager().uberClassLoader;
|
||||
}
|
||||
|
||||
public String call() throws RuntimeException {
|
||||
GroovyShell shell = new GroovyShell();
|
||||
// if we run locally, cl!=null. Otherwise the delegating classloader will be available as context classloader.
|
||||
if (cl==null) cl = Thread.currentThread().getContextClassLoader();
|
||||
GroovyShell shell = new GroovyShell(cl);
|
||||
|
||||
StringWriter out = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(out);
|
||||
|
||||
Reference in new issue
Block a user