changeset 415:5a72ba18c471

6877759: test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java leaves open file Reviewed-by: darcy
author jjg
date Mon, 31 Aug 2009 19:43:06 -0700
parents 45301370bc5a
children dda7e13f09fb
files test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java
diffstat 1 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java	Mon Aug 31 18:25:00 2009 -0700
+++ b/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);
         }