Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix JENKINS-20770
Used a local variable for the expanded presend script instead of
reassigning to the original variable
  • Loading branch information
unknown committed Nov 27, 2013
1 parent 8990a48 commit c6425f4
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -377,8 +377,8 @@ private List<TokenMacro> getRuntimeMacros(ExtendedEmailPublisherContext context)
private boolean executePresendScript(ExtendedEmailPublisherContext context, MimeMessage msg)
throws RuntimeException {
boolean cancel = false;
presendScript = new ContentBuilder().transformText(presendScript, context, getRuntimeMacros(context));
if (StringUtils.isNotBlank(presendScript)) {
String script = new ContentBuilder().transformText(presendScript, context, getRuntimeMacros(context));
if (StringUtils.isNotBlank(script)) {
debug(context.getListener().getLogger(), "Executing pre-send script");
ClassLoader cl = Jenkins.getInstance().getPluginManager().uberClassLoader;
ScriptSandbox sandbox = null;
Expand Down Expand Up @@ -412,7 +412,7 @@ private boolean executePresendScript(ExtendedEmailPublisherContext context, Mime
}

try {
Object output = shell.evaluate(presendScript);
Object output = shell.evaluate(script);
if(output!=null) {
pw.println("Result: "+output);
cancel = ((Boolean)shell.getVariable("cancel")).booleanValue();
Expand Down

0 comments on commit c6425f4

Please sign in to comment.