You need to sign in or sign up before continuing.
提交 dd975166 编写于 作者: M mullan

8026346: test/java/lang/SecurityManager/CheckPackageAccess.java failing

Reviewed-by: vinnie
上级 84621ebc
...@@ -205,12 +205,12 @@ package.access=sun.,\ ...@@ -205,12 +205,12 @@ package.access=sun.,\
com.sun.org.glassfish.,\ com.sun.org.glassfish.,\
com.oracle.xmlns.internal.,\ com.oracle.xmlns.internal.,\
com.oracle.webservices.internal.,\ com.oracle.webservices.internal.,\
oracle.jrockit.jfr.,\
org.jcp.xml.dsig.internal.,\ org.jcp.xml.dsig.internal.,\
jdk.internal.,\ jdk.internal.,\
jdk.nashorn.internal.,\ jdk.nashorn.internal.,\
jdk.nashorn.tools.,\ jdk.nashorn.tools.,\
apple.,\ apple.
oracle.jrockit.jfr.
# #
# List of comma-separated packages that start with or equal this string # List of comma-separated packages that start with or equal this string
...@@ -250,12 +250,12 @@ package.definition=sun.,\ ...@@ -250,12 +250,12 @@ package.definition=sun.,\
com.sun.org.glassfish.,\ com.sun.org.glassfish.,\
com.oracle.xmlns.internal.,\ com.oracle.xmlns.internal.,\
com.oracle.webservices.internal.,\ com.oracle.webservices.internal.,\
oracle.jrockit.jfr.,\
org.jcp.xml.dsig.internal.,\ org.jcp.xml.dsig.internal.,\
jdk.internal.,\ jdk.internal.,\
jdk.nashorn.internal.,\ jdk.nashorn.internal.,\
jdk.nashorn.tools.,\ jdk.nashorn.tools.,\
apple.,\ apple.
oracle.jrockit.jfr.
# #
# Determines whether this properties file can be appended to # Determines whether this properties file can be appended to
......
...@@ -29,9 +29,6 @@ ...@@ -29,9 +29,6 @@
* @run main/othervm CheckPackageAccess * @run main/othervm CheckPackageAccess
*/ */
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.security.Security; import java.security.Security;
import java.util.Collections; import java.util.Collections;
import java.util.Arrays; import java.util.Arrays;
...@@ -50,6 +47,7 @@ public class CheckPackageAccess { ...@@ -50,6 +47,7 @@ public class CheckPackageAccess {
/* /*
* This array should be updated whenever new packages are added to the * This array should be updated whenever new packages are added to the
* package.access property in the java.security file * 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 = { private static final String[] packages = {
"sun.", "sun.",
...@@ -99,14 +97,14 @@ public class CheckPackageAccess { ...@@ -99,14 +97,14 @@ public class CheckPackageAccess {
List<String> jspkgs = List<String> jspkgs =
getPackages(Security.getProperty("package.access")); getPackages(Security.getProperty("package.access"));
// get closed restricted packages if (!isOpenJDKOnly()) {
File f = new File(System.getProperty("test.src"), String lastPkg = pkgs.get(pkgs.size() - 1);
"../../../../src/closed/share/lib/security/restricted.pkgs");
if (f.exists()) {
List<String> ipkgs = Files.readAllLines(f.toPath(),
StandardCharsets.UTF_8);
// Remove any closed packages from list before comparing // 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 // Sort to ensure lists are comparable
...@@ -164,4 +162,9 @@ public class CheckPackageAccess { ...@@ -164,4 +162,9 @@ public class CheckPackageAccess {
} }
return packages; return packages;
} }
private static boolean isOpenJDKOnly() {
String prop = System.getProperty("java.runtime.name");
return prop != null && prop.startsWith("OpenJDK");
}
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册