Skip to content
Permalink
Browse files
[JENKINS-11592] trying to find out where the NPE is originated(cherry…
… picked from commit 4f900f6)

Conflicts:

	maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
  • Loading branch information
kutzi authored and vjuranek committed Feb 1, 2012
1 parent 3554a4c commit 4d3538aa4df601009f5c29b5a95dd8374d281a9a
Showing 2 changed files with 12 additions and 2 deletions.
@@ -1784,6 +1784,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 {
@@ -46,6 +46,7 @@
import hudson.model.Executor;
import hudson.model.Fingerprint;
import jenkins.model.Jenkins;
import hudson.model.Node;
import hudson.model.ParameterDefinition;
import hudson.model.ParametersAction;
import hudson.model.ParametersDefinitionProperty;
@@ -169,8 +170,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;

0 comments on commit 4d3538a

Please sign in to comment.