langtools/test/tools/javac/api/TestJavacTask_Lock.java
changeset 27319 030080f03e4f
parent 26264 a09fedde76be
child 30730 d3ce7619db2c
--- a/langtools/test/tools/javac/api/TestJavacTask_Lock.java	Wed Oct 29 12:09:17 2014 +0100
+++ b/langtools/test/tools/javac/api/TestJavacTask_Lock.java	Wed Oct 29 17:25:23 2014 -0700
@@ -67,15 +67,18 @@
     void run() throws Exception {
         comp = ToolProvider.getSystemJavaCompiler();
         fm = comp.getStandardFileManager(null, null, null);
-
-        for (MethodKind first: MethodKind.values()) {
-            for (MethodKind second: MethodKind.values()) {
-                test(first, second);
+        try {
+            for (MethodKind first: MethodKind.values()) {
+                for (MethodKind second: MethodKind.values()) {
+                    test(first, second);
+                }
             }
+
+            if (errors > 0)
+                throw new Exception(errors + " errors found");
+        } finally {
+            fm.close();
         }
-
-        if (errors > 0)
-            throw new Exception(errors + " errors found");
     }
 
     void test(MethodKind first, MethodKind second) {