You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2017/12/10 07:52:55 UTC

ant git commit: make sure stream is close so file can be deleted on windows

Repository: ant
Updated Branches:
  refs/heads/1.9.x 4796589e8 -> 168b405e3


make sure stream is close so file can be deleted on windows


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/168b405e
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/168b405e
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/168b405e

Branch: refs/heads/1.9.x
Commit: 168b405e3e27fe1d2f55bfa14c3ce1cc5d9d58c4
Parents: 4796589
Author: Stefan Bodewig <bo...@apache.org>
Authored: Sun Dec 10 08:52:30 2017 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Sun Dec 10 08:52:30 2017 +0100

----------------------------------------------------------------------
 src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/168b405e/src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java
index fc03f28..f7780e3 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java
@@ -222,11 +222,15 @@ public class CopyTest {
         buildRule.executeTarget("testFileResourceWithFilter");
         File file1 = new File(buildRule.getProject().getProperty("to.dir") + "/fileNR.txt");
         assertTrue(file1.exists());
+        FileReader f = null;
         try {
-            String file1Content = FileUtils.readFully(new FileReader(file1));
+            f = new FileReader(file1);
+            String file1Content = FileUtils.readFully(f);
             assertEquals("This is file 42", file1Content);
         } catch (IOException e) {
             // no-op: not a real business error
+        } finally {
+            FileUtils.close(f);
         }
     }