6877759: test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java leaves open file
authorjjg
Mon, 31 Aug 2009 19:43:06 -0700
changeset 3777 9d8c7669df64
parent 3776 c516c9b3fb72
child 3778 38a70273507b
6877759: test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java leaves open file Reviewed-by: darcy
langtools/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java
--- a/langtools/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java	Mon Aug 31 18:25:00 2009 -0700
+++ b/langtools/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java	Mon Aug 31 19:43:06 2009 -0700
@@ -188,14 +188,18 @@
             // Copy the bytes over
             System.out.println((new File(".")).getAbsolutePath());
             InputStream io = new BufferedInputStream(new FileInputStream(new File(".", "Foo.class")));
-            int datum = io.read();
-            while(datum != -1) {
-                os.write(datum);
-                datum = io.read();
+            try {
+                int datum = io.read();
+                while(datum != -1) {
+                    os.write(datum);
+                    datum = io.read();
+                }
+            } finally {
+                io.close();
             }
             os.close();
-        } catch (IOException io) {
-            throw new RuntimeException(io);
+        } catch (IOException ioe) {
+            throw new RuntimeException(ioe);
         }