From ba8e9c24307bf832f34266659b7d0a86b0a15f8d Mon Sep 17 00:00:00 2001 From: sherman Date: Wed, 23 Jan 2013 10:29:50 -0800 Subject: [PATCH] 8006773: test/java/util/zip/ZipFile/FinalizeZipFile.java failing intermittently Summary: fixed the test case Reviewed-by: alanb --- test/java/util/zip/ZipFile/FinalizeZipFile.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/java/util/zip/ZipFile/FinalizeZipFile.java b/test/java/util/zip/ZipFile/FinalizeZipFile.java index 56ac12efb..1c27e8482 100644 --- a/test/java/util/zip/ZipFile/FinalizeZipFile.java +++ b/test/java/util/zip/ZipFile/FinalizeZipFile.java @@ -67,9 +67,14 @@ public class FinalizeZipFile { 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 @@ public class FinalizeZipFile { System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); if (failed > 0) throw new AssertionError("Some tests failed");} } - -- GitLab