Skip to content
Permalink
Browse files
[Fixed JENKINS-11652] Avoid NPE, add fallback if groovy executable is…
… misconfigured.
  • Loading branch information
vjuranek committed Jan 20, 2012
1 parent 8e8af9f commit 6ab2c9a830133e3f262102345d9be1ab8fde9066
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/main/java/hudson/plugins/groovy/Groovy.java
@@ -108,7 +108,7 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListen

envVars.put("$PATH_SEPARATOR",":::");


System.out.println("Groovy cmd" + cmd[0]);
result = launcher.launch().cmds(cmd).envs(envVars).stdout(listener).pwd(ws).join();
} catch (IOException e) {
Util.displayIOException(e,listener);
@@ -269,6 +269,11 @@ protected String[] buildCommandLine(AbstractBuild build, BuildListener listener,
installation = installation.forNode(Computer.currentComputer().getNode(), listener);
installation = installation.forEnvironment(env);
cmd = installation.getExecutable(script.getChannel());
//some misconfiguration, reverting back to default groovy cmd
if(null == cmd){
cmd = "groovy";
listener.getLogger().println("[GROVY WARNING] Groovy executable is NULL, please chekc your Groovy configuration, trying fallback 'groovy' instead.");
}
}
list.add(cmd);

0 comments on commit 6ab2c9a

Please sign in to comment.