Skip to content

Commit

Permalink
Merge pull request #49 from jglick/remoting-class-version-JENKINS-25272
Browse files Browse the repository at this point in the history
[JENKINS-25272] Extend JENKINS-18403 workaround for newer remoting.jar
  • Loading branch information
jglick committed Aug 7, 2015
2 parents 02ca060 + 0913aa1 commit c88577a
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 c88577a

Please sign in to comment.