Browse Source

properly close stream in test

master
Stefan Bodewig 11 years ago
parent
commit
4965535328
1 changed files with 9 additions and 3 deletions
  1. +9
    -3
      src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java

+ 9
- 3
src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java View File

@@ -288,16 +288,22 @@ public class ManifestTest {
value = mainSection.getAttributeValue(NOT_LONG_NAME); value = mainSection.getAttributeValue(NOT_LONG_NAME);
assertEquals("NOT_LONG_NAME_VALUE_MISMATCH", VALUE, value); assertEquals("NOT_LONG_NAME_VALUE_MISMATCH", VALUE, value);
BufferedReader in = new BufferedReader(new FileReader(expandedManifest));
Set set = new HashSet(); Set set = new HashSet();
FileReader fin = new FileReader(expandedManifest);
try {
BufferedReader in = new BufferedReader(fin);
String read = in.readLine(); String read = in.readLine();
while (read != null) while (read != null)
{ {
set.add(read); set.add(read);
read = in.readLine(); read = in.readLine();
} }
in.close();
} finally {
fin.close();
}

assertTrue("Manifest file should have contained string ", set assertTrue("Manifest file should have contained string ", set
.remove(" NOT_LONG")); .remove(" NOT_LONG"));
assertTrue("Manifest file should have contained string ", set assertTrue("Manifest file should have contained string ", set


Loading…
Cancel
Save