Source:
private String attemptToInstallJDK(TaskListener listener, String workingDirectory) throws IOException, InterruptedException { ByteArrayOutputStream unameOutput = new ByteArrayOutputStream(); if (connection.exec("uname -a",new TeeOutputStream(unameOutput,listener.getLogger()))!=0) throw new IOException("Failed to run 'uname' to obtain the environment"); final String uname; try { uname = unameOutput.toString(Charset.defaultCharset().name()); } catch (UnsupportedEncodingException ex) { throw new IOException("Default encoding is unsupported"); } Platform p = null; CPU cpu = null; if (uname.contains("GNU/Linux")) p = Platform.LINUX; if (uname.contains("SunOS")) p = Platform.SOLARIS; if (uname.contains("CYGWIN")) p = Platform.WINDOWS; if (uname.contains("Windows_NT")) p = Platform.WINDOWS; if (uname.contains("sparc")) cpu = CPU.Sparc; if (uname.contains("x86_64")) cpu = CPU.amd64; if (Pattern.compile("\\bi?[3-6]86\\b").matcher(uname).find()) cpu = CPU.i386; if (p==null || cpu==null) throw new IOException(Messages.SSHLauncher_FailedToDetectEnvironment(uname)); String javaDir = workingDirectory + "/jdk"; String bundleFile = workingDirectory + "/" + p.bundleFileName; SFTPClient sftp = new SFTPClient(connection); connection.exec("rm -rf "+javaDir,listener.getLogger()); sftp.mkdirs(javaDir, 0755); URL bundle = getJDKInstaller().locate(listener, p, cpu); listener.getLogger().println("Installing " + JDKVERSION); Util.copyStreamAndClose(bundle.openStream(),new BufferedOutputStream(sftp.writeToFile(bundleFile),32*1024)); sftp.chmod(bundleFile,0755); getJDKInstaller().install(new RemoteLauncher(listener,connection),p,new SFTPFileSystem(sftp),listener, javaDir,bundleFile); return javaDir+"/bin/java"; }

Target:
private String attemptToInstallJDK(TaskListener listener, String workingDirectory) throws IOException, InterruptedException { ByteArrayOutputStream unameOutput = new ByteArrayOutputStream(); if (connection.exec("uname -a",new TeeOutputStream(unameOutput,listener.getLogger()))!=0) throw new IOException("Failed to run 'uname' to obtain the environment"); final String uname; try { uname = unameOutput.toString(Charset.defaultCharset().name()); } catch (UnsupportedEncodingException ex) { throw new IOException("Default encoding is unsupported", ex); } Platform p = null; CPU cpu = null; if (uname.contains("GNU/Linux")) p = Platform.LINUX; if (uname.contains("SunOS")) p = Platform.SOLARIS; if (uname.contains("CYGWIN")) p = Platform.WINDOWS; if (uname.contains("Windows_NT")) p = Platform.WINDOWS; if (uname.contains("sparc")) cpu = CPU.Sparc; if (uname.contains("x86_64")) cpu = CPU.amd64; if (Pattern.compile("\\bi?[3-6]86\\b").matcher(uname).find()) cpu = CPU.i386; if (p==null || cpu==null) throw new IOException(Messages.SSHLauncher_FailedToDetectEnvironment(uname)); String javaDir = workingDirectory + "/jdk"; String bundleFile = workingDirectory + "/" + p.bundleFileName; SFTPClient sftp = new SFTPClient(connection); connection.exec("rm -rf "+javaDir,listener.getLogger()); sftp.mkdirs(javaDir, 0755); URL bundle = getJDKInstaller().locate(listener, p, cpu); listener.getLogger().println("Installing " + JDKVERSION); Util.copyStreamAndClose(bundle.openStream(),new BufferedOutputStream(sftp.writeToFile(bundleFile),32*1024)); sftp.chmod(bundleFile,0755); getJDKInstaller().install(new RemoteLauncher(listener,connection),p,new SFTPFileSystem(sftp),listener, javaDir,bundleFile); return javaDir+"/bin/java"; }