changeset 8469:5d866df64ae3

8026346: test/java/lang/SecurityManager/CheckPackageAccess.java failing Reviewed-by: vinnie
author mullan
date Thu, 17 Oct 2013 10:18:44 -0400
parents 94493b5800bb
children 04e8b8fc6906
files src/share/lib/security/java.security-macosx test/java/lang/SecurityManager/CheckPackageAccess.java
diffstat 2 files changed, 17 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/lib/security/java.security-macosx	Fri Oct 11 20:47:16 2013 +0100
+++ b/src/share/lib/security/java.security-macosx	Thu Oct 17 10:18:44 2013 -0400
@@ -205,12 +205,12 @@
                com.sun.org.glassfish.,\
                com.oracle.xmlns.internal.,\
                com.oracle.webservices.internal.,\
+               oracle.jrockit.jfr.,\
                org.jcp.xml.dsig.internal.,\
                jdk.internal.,\
                jdk.nashorn.internal.,\
                jdk.nashorn.tools.,\
-               apple.,\
-               oracle.jrockit.jfr.
+               apple.
 
 #
 # List of comma-separated packages that start with or equal this string
@@ -250,12 +250,12 @@
                    com.sun.org.glassfish.,\
                    com.oracle.xmlns.internal.,\
                    com.oracle.webservices.internal.,\
+                   oracle.jrockit.jfr.,\
                    org.jcp.xml.dsig.internal.,\
                    jdk.internal.,\
                    jdk.nashorn.internal.,\
                    jdk.nashorn.tools.,\
-                   apple.,\
-                   oracle.jrockit.jfr.
+                   apple.
 
 #
 # Determines whether this properties file can be appended to
--- a/test/java/lang/SecurityManager/CheckPackageAccess.java	Fri Oct 11 20:47:16 2013 +0100
+++ b/test/java/lang/SecurityManager/CheckPackageAccess.java	Thu Oct 17 10:18:44 2013 -0400
@@ -29,9 +29,6 @@
  *  @run main/othervm CheckPackageAccess
  */
 
-import java.io.File;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
 import java.security.Security;
 import java.util.Collections;
 import java.util.Arrays;
@@ -50,6 +47,7 @@
     /*
      * This array should be updated whenever new packages are added to the
      * package.access property in the java.security file
+     * NOTE: it should be in the same order as the java.security file
      */
     private static final String[] packages = {
         "sun.",
@@ -99,14 +97,14 @@
         List<String> jspkgs =
             getPackages(Security.getProperty("package.access"));
 
-        // get closed restricted packages
-        File f = new File(System.getProperty("test.src"),
-            "../../../../src/closed/share/lib/security/restricted.pkgs");
-        if (f.exists()) {
-            List<String> ipkgs = Files.readAllLines(f.toPath(),
-                                                    StandardCharsets.UTF_8);
+        if (!isOpenJDKOnly()) {
+            String lastPkg = pkgs.get(pkgs.size() - 1);
+
             // Remove any closed packages from list before comparing
-            jspkgs.removeAll(ipkgs);
+            int index = jspkgs.indexOf(lastPkg);
+            if (index != -1 && index != jspkgs.size() - 1) {
+                jspkgs.subList(index + 1, jspkgs.size()).clear();
+            }
         }
 
         // Sort to ensure lists are comparable
@@ -164,4 +162,9 @@
         }
         return packages;
     }
+
+    private static boolean isOpenJDKOnly() {
+        String prop = System.getProperty("java.runtime.name");
+        return prop != null && prop.startsWith("OpenJDK");
+    }
 }