jdk/test/java/io/InputStream/OpsAfterClose.java
changeset 5810 e83d67ad8c96
parent 5506 202f599c92aa
child 7668 d4a77089c587
--- a/jdk/test/java/io/InputStream/OpsAfterClose.java	Fri Jun 18 20:59:13 2010 +0100
+++ b/jdk/test/java/io/InputStream/OpsAfterClose.java	Sat Jun 19 15:17:36 2010 +0100
@@ -125,23 +125,35 @@
         f.deleteOnExit();
 
         FileInputStream fis = new FileInputStream(f);
-        if (testInputStream(fis)) {
-            failed = true;
-        }
-        if (testFileInputStream(fis)) {
-            failed = true;
+        try {
+            if (testInputStream(fis)) {
+                failed = true;
+            }
+            if (testFileInputStream(fis)) {
+                failed = true;
+            }
+        } finally {
+            fis.close();
         }
 
         BufferedInputStream bs =  new BufferedInputStream(
                                         new FileInputStream(f));
-        if (testInputStream(bs)) {
-            failed = true;
+        try {
+            if (testInputStream(bs)) {
+                failed = true;
+            }
+        } finally {
+            bs.close();
         }
 
         DataInputStream dis = new DataInputStream(
                                 new FileInputStream(f));
-        if (testInputStream(dis)) {
-            failed = true;
+        try {
+            if (testInputStream(dis)) {
+                failed = true;
+            }
+        } finally {
+            dis.close();
         }
 
         PushbackInputStream pbis = new PushbackInputStream(