diff --git a/core/src/test/java/hudson/FilePathTest.java b/core/src/test/java/hudson/FilePathTest.java new file mode 100644 index 0000000000..accd09d5a6 --- /dev/null +++ b/core/src/test/java/hudson/FilePathTest.java @@ -0,0 +1,26 @@ +package hudson; + +import junit.framework.TestCase; + +/** + * @author Kohsuke Kawaguchi + */ +public class FilePathTest extends /*RmiTestBase*/ TestCase { + public void testDummy() { + // TODO: figure out how to reuse test code from the remoting module. + // currently it fails because the remoting.jar is signed but + // test code is not. + } + + ///** + // * Copy zero files. + // */ + //public void testEmptyCopy() throws Exception { + // File src = Util.createTempDir(); + // File dst = Util.createTempDir(); + // src.deleteOnExit(); + // dst.deleteOnExit(); + // + // new FilePath(src).copyRecursiveTo("**/*",new FilePath(channel,dst.getPath())); + //} +} diff --git a/remoting/src/main/java/hudson/remoting/ProxyOutputStream.java b/remoting/src/main/java/hudson/remoting/ProxyOutputStream.java index 8caa04b9f5..91598df721 100644 --- a/remoting/src/main/java/hudson/remoting/ProxyOutputStream.java +++ b/remoting/src/main/java/hudson/remoting/ProxyOutputStream.java @@ -57,7 +57,7 @@ final class ProxyOutputStream extends OutputStream { tmp = null; } if(closed) // already marked closed? - close(); + doClose(); } public void write(int b) throws IOException { @@ -96,11 +96,14 @@ final class ProxyOutputStream extends OutputStream { public synchronized void close() throws IOException { closed = true; - if(channel!=null) { - channel.send(new EOF(oid)); - channel = null; - oid = -1; - } + if(channel!=null) + doClose(); + } + + private void doClose() throws IOException { + channel.send(new EOF(oid)); + channel = null; + oid = -1; } protected void finalize() throws Throwable {