Browse Source

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

master
Stefan Bodewig 7 years ago
parent
commit
168b405e3e
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java

+ 5
- 1
src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java View File

@@ -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);
}
}



Loading…
Cancel
Save