diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java index b7b5b2d79d..1d27e35d7e 100644 --- a/core/src/main/java/hudson/FilePath.java +++ b/core/src/main/java/hudson/FilePath.java @@ -1167,19 +1167,22 @@ public final class FilePath implements Serializable { * Creates this directory. */ public void mkdirs() throws IOException, InterruptedException { - if(!act(new SecureFileCallable() { - private static final long serialVersionUID = 1L; - public Boolean invoke(File f, VirtualChannel channel) throws IOException, InterruptedException { - if(mkdirs(f) || f.exists()) - return true; // OK + if (!act(new Mkdirs())) { + throw new IOException("Failed to mkdirs: " + remote); + } + } + private class Mkdirs extends SecureFileCallable { + private static final long serialVersionUID = 1L; + @Override + public Boolean invoke(File f, VirtualChannel channel) throws IOException, InterruptedException { + if(mkdirs(f) || f.exists()) + return true; // OK - // following Ant task to avoid possible race condition. - Thread.sleep(10); + // following Ant task to avoid possible race condition. + Thread.sleep(10); - return mkdirs(f) || f.exists(); - } - })) - throw new IOException("Failed to mkdirs: "+remote); + return mkdirs(f) || f.exists(); + } } /** @@ -2828,6 +2831,11 @@ public final class FilePath implements Serializable { return classLoader; } + @Override + public String toString() { + return callable.toString(); + } + private static final long serialVersionUID = 1L; } diff --git a/core/src/main/java/hudson/slaves/SlaveComputer.java b/core/src/main/java/hudson/slaves/SlaveComputer.java index 1f3f2beb13..c1b5166e71 100644 --- a/core/src/main/java/hudson/slaves/SlaveComputer.java +++ b/core/src/main/java/hudson/slaves/SlaveComputer.java @@ -88,6 +88,7 @@ import java.util.logging.LogRecord; import java.util.logging.Logger; import static hudson.slaves.SlaveComputer.LogHolder.SLAVE_LOG_HANDLER; +import org.jenkinsci.remoting.util.LoggingChannelListener; /** @@ -520,7 +521,7 @@ public class SlaveComputer extends Computer { channel.setProperty(SlaveComputer.class, this); - channel.addListener(new Channel.Listener() { + channel.addListener(new LoggingChannelListener(logger, Level.FINEST) { @Override public void onClosed(Channel c, IOException cause) { // Orderly shutdown will have null exception diff --git a/pom.xml b/pom.xml index 5320d6507b..8ede8e8440 100644 --- a/pom.xml +++ b/pom.xml @@ -105,7 +105,7 @@ THE SOFTWARE. 3.0.0 - 3.16 + 3.17 2.60 diff --git a/test/src/test/java/hudson/bugs/JnlpAccessWithSecuredHudsonTest.java b/test/src/test/java/hudson/bugs/JnlpAccessWithSecuredHudsonTest.java index dcd8989846..8e0ce19006 100644 --- a/test/src/test/java/hudson/bugs/JnlpAccessWithSecuredHudsonTest.java +++ b/test/src/test/java/hudson/bugs/JnlpAccessWithSecuredHudsonTest.java @@ -139,7 +139,7 @@ public class JnlpAccessWithSecuredHudsonTest { assertTrue(f.exists()); try { fail("SECURITY-206: " + channel.call(new Attack(f.getAbsolutePath()))); - } catch (SecurityException x) { + } catch (Exception x) { assertThat(Functions.printThrowable(x), containsString("https://jenkins.io/redirect/security-144")); } } finally { diff --git a/test/src/test/java/jenkins/security/Security218Test.java b/test/src/test/java/jenkins/security/Security218Test.java index fa1fb1853f..b3cfc83d43 100644 --- a/test/src/test/java/jenkins/security/Security218Test.java +++ b/test/src/test/java/jenkins/security/Security218Test.java @@ -75,7 +75,7 @@ public class Security218Test implements Serializable { try { Object o = s.getComputer().getChannel().call(new EvilReturnValue()); fail("Expected the connection to die: " + o); - } catch (SecurityException e) { + } catch (Exception e) { assertThat(e.getMessage(), containsString(MethodClosure.class.getName())); } } diff --git a/test/src/test/java/jenkins/security/s2m/DefaultFilePathFilterTest.java b/test/src/test/java/jenkins/security/s2m/DefaultFilePathFilterTest.java index 8dd83964cd..c7e3883b4a 100644 --- a/test/src/test/java/jenkins/security/s2m/DefaultFilePathFilterTest.java +++ b/test/src/test/java/jenkins/security/s2m/DefaultFilePathFilterTest.java @@ -63,7 +63,7 @@ public class DefaultFilePathFilterTest { try { s.getChannel().call(new ReverseCallable(reverse)); fail("should have failed"); - } catch (SecurityException x) { + } catch (Exception x) { // good // make sure that the stack trace contains the call site info to help assist diagnosis