Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-11458] when building with Maven 3, Channel.current() inside …
…FilterImpl sometimes returns null. Therefore pass channel into constructor, thus effectively restoring pre-1.435 behaviour.

Originally-Committed-As: 609b321e6ee0963908dddda048d572f2550e75aa
  • Loading branch information
kutzi committed Oct 26, 2011
1 parent 71ad038 commit 1c1415b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
19 changes: 18 additions & 1 deletion src/main/java/hudson/maven/AbstractMavenBuilder.java
Expand Up @@ -163,16 +163,33 @@ protected Result waitForAsynchronousExecutions() {
protected class FilterImpl extends MavenBuildProxy2.Filter<MavenBuildProxy2> implements Serializable {

private MavenBuildInformation mavenBuildInformation;
private Channel channel;

public FilterImpl(MavenBuildProxy2 core, MavenBuildInformation mavenBuildInformation) {
super(core);
this.mavenBuildInformation = mavenBuildInformation;
}

public FilterImpl(MavenBuildProxy2 core, MavenBuildInformation mavenBuildInformation, Channel channel) {
super(core);
this.mavenBuildInformation = mavenBuildInformation;
if (channel == null) {
throw new NullPointerException("channel must not be null!");
}
this.channel = channel;
}

@Override
public void executeAsync(final BuildCallable<?,?> program) throws IOException {

Channel ch = this.channel != null ? this.channel : Channel.current();

if (ch == null) {
throw new NullPointerException("current channel not available!");
}

recordAsynchronousExecution(
Channel.current().callAsync(
ch.callAsync(
new AsyncInvoker(core,program)));
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hudson/maven/Maven3Builder.java
Expand Up @@ -89,7 +89,7 @@ protected Maven3Builder(BuildListener listener,Map<ModuleName,ProxyImpl2> proxie
sourceProxies = new HashMap<ModuleName, ProxyImpl2>(proxies);
this.proxies = new HashMap<ModuleName, MavenBuildProxy2>(proxies);
for (Entry<ModuleName,MavenBuildProxy2> e : this.proxies.entrySet())
e.setValue(new FilterImpl(e.getValue(), this.mavenBuildInformation));
e.setValue(new FilterImpl(e.getValue(), this.mavenBuildInformation, Channel.current()));

this.reporters.putAll( reporters );
}
Expand Down

0 comments on commit 1c1415b

Please sign in to comment.