Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-11592] trying to find out where the NPE is originated
  • Loading branch information
kutzi committed Nov 8, 2011
1 parent ee38d15 commit 4f900f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions core/src/main/java/hudson/model/Run.java
Expand Up @@ -1816,6 +1816,8 @@ public EnvVars getEnvironment() throws IOException, InterruptedException {
* <p>
* Unlike earlier {@link #getEnvVars()}, this map contains the whole environment,
* not just the overrides, so one can introspect values to change its behavior.
*
* @return the map with the environmental variables. Never <code>null</code>.
* @since 1.305
*/
public EnvVars getEnvironment(TaskListener log) throws IOException, InterruptedException {
Expand Down
12 changes: 10 additions & 2 deletions maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
Expand Up @@ -46,6 +46,7 @@
import hudson.model.Environment;
import hudson.model.Executor;
import hudson.model.Fingerprint;
import hudson.model.Node;
import hudson.model.ParameterDefinition;
import hudson.model.ParametersAction;
import hudson.model.ParametersDefinitionProperty;
Expand Down Expand Up @@ -162,8 +163,15 @@ public EnvVars getEnvironment(TaskListener log) throws IOException, InterruptedE
if (mvn == null)
throw new AbortException(Messages.MavenModuleSetBuild_NoMavenConfigured());

mvn = mvn.forEnvironment(envs).forNode(
Computer.currentComputer().getNode(), log);

mvn = mvn.forEnvironment(envs);
Node node = Computer.currentComputer().getNode();
if (node == null) {
log.getLogger().println("WARNING: cannot get current node: "+Computer.currentComputer());
return envs;
}
mvn = mvn.forNode(node, log);

envs.put("M2_HOME", mvn.getHome());
envs.put("PATH+MAVEN", mvn.getHome() + "/bin");
return envs;
Expand Down

0 comments on commit 4f900f6

Please sign in to comment.