Skip to content

Commit

Permalink
[Fixed JENKINS-11652] Avoid NPE, add fallback if groovy executable is…
Browse files Browse the repository at this point in the history
… misconfigured.
  • Loading branch information
vjuranek committed Jan 20, 2012
1 parent 8e8af9f commit 6ab2c9a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/java/hudson/plugins/groovy/Groovy.java
Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 6ab2c9a

Please sign in to comment.