Skip to content

Commit

Permalink
[FIXED JENKINS-25272] Extend JENKINS-18403 workaround for newer remot…
Browse files Browse the repository at this point in the history
…ing.jar built with -target 6.

Also handle a SocketException in Channels.forProcess, arising because Maven31Main tries to load remoting classes and fails.
  • Loading branch information
jglick committed Aug 4, 2015
1 parent 02ca060 commit 0913aa1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main/java/hudson/maven/AbstractMavenProcessFactory.java
Expand Up @@ -46,6 +46,7 @@
import javax.annotation.CheckForNull;

import hudson.util.StreamCopyThread;
import java.net.SocketException;
import jenkins.model.Jenkins;
import jenkins.security.MasterToSlaveCallable;
import org.apache.tools.ant.Project;
Expand Down Expand Up @@ -277,15 +278,16 @@ public ProcessCache.NewProcess newProcess(BuildListener listener, OutputStream o
throw e;
}

Channel ch = Channels.forProcess("Channel to Maven " + Arrays.toString(cmds),
Computer.threadPoolForRemoting, new BufferedInputStream(con.in), new BufferedOutputStream(con.out),
listener.getLogger(), proc);
Channel ch;
try {
ch = Channels.forProcess("Channel to Maven " + Arrays.toString(cmds),
Computer.threadPoolForRemoting, new BufferedInputStream(con.in), new BufferedOutputStream(con.out),
listener.getLogger(), proc);
ch.call(new ConfigureOriginalJDK(originalJdk));
} catch (IOException x) {
if (originalJdk == null) { // so we only try this once
for (Throwable t = x; t != null; t = t.getCause()) {
if (t instanceof UnsupportedClassVersionError) {
if (t instanceof UnsupportedClassVersionError || t instanceof SocketException) {
listener.error("[JENKINS-18403] JDK 5 not supported to run Maven; retrying with slave Java and setting compile/test properties to point to " + jdk.getHome());
originalJdk = jdk;
jdk = launcher.getChannel().call(new FindJavaHome());
Expand Down

0 comments on commit 0913aa1

Please sign in to comment.