Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Commit

Permalink
[JENKINS-25348]
Browse files Browse the repository at this point in the history
Use the new wrapper classloader to ensure groovy-sandbox resolves
correctly.
  • Loading branch information
kohsuke committed Nov 15, 2014
1 parent 289c9b0 commit ed56f11
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Expand Up @@ -11,6 +11,7 @@
import org.codehaus.groovy.control.CompilationFailedException;
import org.codehaus.groovy.control.CompilerConfiguration;
import org.codehaus.groovy.control.customizers.ImportCustomizer;
import org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox;

import javax.annotation.Nullable;
import java.io.IOException;
Expand Down Expand Up @@ -39,7 +40,8 @@ class CpsGroovyShell extends GroovyShell {

private static ClassLoader makeClassLoader() {
Jenkins j = Jenkins.getInstance();
return j!=null ? j.getPluginManager().uberClassLoader : CpsGroovyShell.class.getClassLoader();
ClassLoader cl = j != null ? j.getPluginManager().uberClassLoader : CpsGroovyShell.class.getClassLoader();
return GroovySandbox.createSecureClassLoader(cl);
}

private static CompilerConfiguration makeConfig(CpsFlowExecution execution) {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -72,7 +72,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>script-security</artifactId>
<version>1.6</version>
<version>1.9</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand Down

0 comments on commit ed56f11

Please sign in to comment.