changeset 10784:b11ecf1f46a2

8058855: Update java.util.zip tests to work with modular image Reviewed-by: dholmes, sherman, alanb Contributed-by: amy.lu@oracle.com
author alanb
date Sat, 11 Oct 2014 13:24:23 +0100
parents 5c507b7ee225
children bd36c65a117c
files test/java/util/zip/InterruptibleZip.java test/java/util/zip/ZipFile/FinalizeZipFile.java
diffstat 2 files changed, 7 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/test/java/util/zip/InterruptibleZip.java	Fri Oct 10 21:28:35 2014 +0400
+++ b/test/java/util/zip/InterruptibleZip.java	Sat Oct 11 13:24:23 2014 +0100
@@ -30,32 +30,14 @@
 import java.util.zip.*;
 
 public class InterruptibleZip {
-    private static String rtJar() {
-        String bcp = System.getProperty("sun.boot.class.path");
-        for (String pathElement : bcp.split(File.pathSeparator)) {
-            if (pathElement.endsWith(File.separator + "rt.jar") &&
-                new File(pathElement).exists()) {
-                System.out.println("rtJar="+pathElement);
-                return pathElement;
-            }
-            if (pathElement.endsWith(File.separator + "classes") &&
-                new File(pathElement).isDirectory()) {
-                System.out.println("rt.jar not available");
-                return null;
-            }
-        }
-        throw new Error("Can't find rt.jar or classes directory");
-    }
 
     public static void main(String[] args) throws Exception {
         /* Interrupt the current thread. The is.read call below
-           should continue reading rt.jar.
+           should continue reading input.jar.
         */
-        String rtJar = rtJar();
-        if (rtJar == null) return;
         Thread.currentThread().interrupt();
-        ZipFile zf = new ZipFile(rtJar);
-        ZipEntry ze = zf.getEntry("java/lang/Object.class");
+        ZipFile zf = new ZipFile(new File(System.getProperty("test.src", "."), "input.jar"));
+        ZipEntry ze = zf.getEntry("Available.java");
         InputStream is = zf.getInputStream(ze);
         byte[] buf = new byte[512];
         int n = is.read(buf);
--- a/test/java/util/zip/ZipFile/FinalizeZipFile.java	Fri Oct 10 21:28:35 2014 +0400
+++ b/test/java/util/zip/ZipFile/FinalizeZipFile.java	Sat Oct 11 13:24:23 2014 +0100
@@ -51,12 +51,11 @@
 
     private static void makeGarbage() throws Throwable {
         final Random rnd = new Random();
-        final String javaHome = System.getProperty("java.home");
         // Create some ZipFiles.
-        // Find some .jar files in JDK's lib directory.
-        final File lib = new File(javaHome, "lib");
-        check(lib.isDirectory());
-        final File[] jars = lib.listFiles(
+        // Find some .jar files in test directory.
+        final File testdir = new File(System.getProperty("test.src", "."));
+        check(testdir.isDirectory());
+        final File[] jars = testdir.listFiles(
             new FilenameFilter() {
                 public boolean accept(File dir, String name) {
                     return name.endsWith(".jar");}});