You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2014/11/01 21:59:41 UTC
svn commit: r1636051 -
/commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java
Author: ggregory
Date: Sat Nov 1 20:59:41 2014
New Revision: 1636051
URL: http://svn.apache.org/r1636051
Log:
Closed file stream at the end of the test method.
Modified:
commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java
Modified: commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java?rev=1636051&r1=1636050&r2=1636051&view=diff
==============================================================================
--- commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java (original)
+++ commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java Sat Nov 1 20:59:41 2014
@@ -590,12 +590,17 @@ public class DefaultExecutorTest {
final File outfile = File.createTempFile("EXEC", ".test");
outfile.deleteOnExit();
final CommandLine cl = new CommandLine(testScript);
- final PumpStreamHandler pumpStreamHandler = new PumpStreamHandler(new FileOutputStream(outfile));
- final DefaultExecutor executor = new DefaultExecutor();
- executor.setStreamHandler(pumpStreamHandler);
- final int exitValue = executor.execute(cl);
- assertFalse(exec.isFailure(exitValue));
- assertTrue(outfile.exists());
+ FileOutputStream outAndErr = new FileOutputStream(outfile);
+ try {
+ final PumpStreamHandler pumpStreamHandler = new PumpStreamHandler(outAndErr);
+ final DefaultExecutor executor = new DefaultExecutor();
+ executor.setStreamHandler(pumpStreamHandler);
+ final int exitValue = executor.execute(cl);
+ assertFalse(exec.isFailure(exitValue));
+ assertTrue(outfile.exists());
+ } finally {
+ outAndErr.close();
+ }
}
/**