Skip to content
Permalink
Browse files

[FIXED JENKINS-25272] Extend JENKINS-18403 workaround for newer remot…

…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 0913aa1f42f004786ea9b34b8cdfdbd9aa8dc4d6
Showing with 6 additions and 4 deletions.
  1. +6 −4 src/main/java/hudson/maven/AbstractMavenProcessFactory.java
@@ -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;
@@ -277,15 +278,16 @@ public String call() throws IOException {
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());

0 comments on commit 0913aa1

Please sign in to comment.
You can’t perform that action at this time.