langtools/test/tools/javac/flow/LVTHarness.java
changeset 27319 030080f03e4f
parent 26784 6be305e56bcb
child 28330 d4bcdcac1211
--- a/langtools/test/tools/javac/flow/LVTHarness.java	Wed Oct 29 12:09:17 2014 +0100
+++ b/langtools/test/tools/javac/flow/LVTHarness.java	Wed Oct 29 17:25:23 2014 -0700
@@ -76,18 +76,21 @@
     static final StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
 
     public static void main(String[] args) throws Exception {
+        try {
+            String testDir = System.getProperty("test.src");
+            fm.setLocation(SOURCE_PATH, Arrays.asList(new File(testDir, "tests")));
 
-        String testDir = System.getProperty("test.src");
-        fm.setLocation(SOURCE_PATH, Arrays.asList(new File(testDir, "tests")));
+            // Make sure classes are written to scratch dir.
+            fm.setLocation(CLASS_OUTPUT, Arrays.asList(new File(".")));
 
-        // Make sure classes are written to scratch dir.
-        fm.setLocation(CLASS_OUTPUT, Arrays.asList(new File(".")));
-
-        for (JavaFileObject jfo : fm.list(SOURCE_PATH, "", Collections.singleton(SOURCE), true)) {
-            new LVTHarness(jfo).check();
-        }
-        if (nerrors > 0) {
-            throw new AssertionError("Errors were found");
+            for (JavaFileObject jfo : fm.list(SOURCE_PATH, "", Collections.singleton(SOURCE), true)) {
+                new LVTHarness(jfo).check();
+            }
+            if (nerrors > 0) {
+                throw new AssertionError("Errors were found");
+            }
+        } finally {
+            fm.close();
         }
     }