jdk/test/java/io/DataInputStream/OpsAfterClose.java
changeset 5810 e83d67ad8c96
parent 5506 202f599c92aa
child 7668 d4a77089c587
--- a/jdk/test/java/io/DataInputStream/OpsAfterClose.java	Fri Jun 18 20:59:13 2010 +0100
+++ b/jdk/test/java/io/DataInputStream/OpsAfterClose.java	Sat Jun 19 15:17:36 2010 +0100
@@ -244,13 +244,19 @@
         f.deleteOnExit();
 
         FileInputStream fis = new FileInputStream(f);
-
-        DataInputStream dis = new DataInputStream(
-                                new FileInputStream(f));
-        if (testDataInputStream(dis)) {
-            failed = true;
+        try {
+            DataInputStream dis = new DataInputStream(
+                                    new FileInputStream(f));
+            try {
+                if (testDataInputStream(dis)) {
+                    failed = true;
+                }
+            } finally {
+                dis.close();
+            }
+        } finally {
+            fis.close();
         }
-
     }
 
     private static boolean testDataInputStream(DataInputStream is)