8006773: test/java/util/zip/ZipFile/FinalizeZipFile.java failing intermittently
authorsherman
Wed, 23 Jan 2013 10:29:50 -0800
changeset 15295 1d90347088c3
parent 15293 42e74ff49a50
child 15296 e652ed68b1c4
8006773: test/java/util/zip/ZipFile/FinalizeZipFile.java failing intermittently Summary: fixed the test case Reviewed-by: alanb
jdk/test/java/util/zip/ZipFile/FinalizeZipFile.java
--- a/jdk/test/java/util/zip/ZipFile/FinalizeZipFile.java	Wed Jan 23 15:12:28 2013 +0000
+++ b/jdk/test/java/util/zip/ZipFile/FinalizeZipFile.java	Wed Jan 23 10:29:50 2013 -0800
@@ -67,9 +67,14 @@
         new InstrumentedZipFile(jars[rnd.nextInt(jars.length)]).close();
 
         // Create a ZipFile and get an input stream from it
-        ZipFile zf = new InstrumentedZipFile(jars[rnd.nextInt(jars.length)]);
-        ZipEntry ze = zf.getEntry("META-INF/MANIFEST.MF");
-        InputStream is = zf.getInputStream(ze);
+        for (int i = 0; i < jars.length + 10; i++) {
+            ZipFile zf = new InstrumentedZipFile(jars[rnd.nextInt(jars.length)]);
+            ZipEntry ze = zf.getEntry("META-INF/MANIFEST.MF");
+            if (ze != null) {
+                InputStream is = zf.getInputStream(ze);
+                break;
+            }
+        }
     }
 
     public static void realMain(String[] args) throws Throwable {
@@ -97,4 +102,3 @@
         System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
         if (failed > 0) throw new AssertionError("Some tests failed");}
 }
-