8224635: Revert 8224256 and add back java/security/SecureClassLoader/DefineClass.java test
authoraeubanks
Thu, 23 May 2019 09:03:58 -0700
changeset 55010 8559810c60f8
parent 55009 cdb107ca16e6
child 55011 2218f9d57d2f
8224635: Revert 8224256 and add back java/security/SecureClassLoader/DefineClass.java test Reviewed-by: mullan Contributed-by: aeubanks@google.com
test/jdk/ProblemList.txt
test/jdk/java/security/SecureClassLoader/DefineClass.java
test/jdk/java/security/SecureClassLoader/DefineClass.policy
--- a/test/jdk/ProblemList.txt	Thu May 23 18:43:47 2019 +0200
+++ b/test/jdk/ProblemList.txt	Thu May 23 09:03:58 2019 -0700
@@ -664,7 +664,6 @@
 sun/security/provider/KeyStore/DKSTest.sh                       8180266 windows-all
 
 sun/security/pkcs11/KeyStore/SecretKeysBasic.sh                 8209398 generic-all
-java/security/SecureClassLoader/DefineClass.java                8224635 generic-all
 
 ############################################################################
 
--- a/test/jdk/java/security/SecureClassLoader/DefineClass.java	Thu May 23 18:43:47 2019 +0200
+++ b/test/jdk/java/security/SecureClassLoader/DefineClass.java	Thu May 23 09:03:58 2019 -0700
@@ -51,13 +51,10 @@
 import java.util.Enumeration;
 import java.util.List;
 import java.util.PropertyPermission;
-import jdk.test.lib.net.IPSupport;
 
 /*
  * @test
  * @bug 6826789 8131486 8130181
- * @library /test/lib
- * @build jdk.test.lib.net.IPSupport
  * @summary Make sure equivalent ProtectionDomains are granted the same
  *          permissions when the CodeSource URLs are different but resolve
  *          to the same ip address after name service resolution.
@@ -88,15 +85,6 @@
         "AAUAAQAGAAAAHQABAAEAAAAFKrcAAbEAAAABAAcAAAAGAAEAAAABAAEACAAA" +
         "AAIACQ==";
 
-    // Base64 encoded bytes of simple class: "package bar2; public class Bar2 {}"
-    private final static String BAR2_CLASS =
-        "yv66vgAAADQADwoAAwAMBwANBwAOAQAGPGluaXQ+AQADKClWAQAEQ29kZQEA" +
-        "D0xpbmVOdW1iZXJUYWJsZQEABG1haW4BABYoW0xqYXZhL2xhbmcvU3RyaW5n" +
-        "OylWAQAKU291cmNlRmlsZQEACUJhcjIuamF2YQwABAAFAQAJYmFyMi9CYXIy" +
-        "AQAQamF2YS9sYW5nL09iamVjdAAhAAIAAwAAAAAAAgABAAQABQABAAYAAAAd" +
-        "AAEAAQAAAAUqtwABsQAAAAEABwAAAAYAAQAAAAEACQAIAAkAAQAGAAAAGQAA" +
-        "AAEAAAABsQAAAAEABwAAAAYAAQAAAAEAAQAKAAAAAgAL";
-
     // Base64 encoded bytes of simple class: "package baz; public class Baz {}"
     private final static String BAZ_CLASS =
         "yv66vgAAADQADQoAAwAKBwALBwAMAQAGPGluaXQ+AQADKClWAQAEQ29kZQEA" +
@@ -149,23 +137,12 @@
                                                       "foo.Foo", FOO_CLASS,
                                                       null);
         checkPerms(perms1, GRANTED_PERMS);
-
-        if (IPSupport.hasIPv4()) {
-            ArrayList<Permission> perms2 = getPermissions(scl, p,
-                                                          "http://127.0.0.1/",
-                                                          "bar.Bar", BAR_CLASS,
-                                                          null);
-            checkPerms(perms2, GRANTED_PERMS);
-            assert(perms1.equals(perms2));
-        }
-        if (IPSupport.hasIPv6()) {
-            ArrayList<Permission> perms2 = getPermissions(scl, p,
-                                                          "http://[::1]/",
-                                                          "bar2.Bar2", BAR2_CLASS,
-                                                          null);
-            checkPerms(perms2, GRANTED_PERMS);
-            assert(perms1.equals(perms2));
-        }
+        ArrayList<Permission> perms2 = getPermissions(scl, p,
+                                                      "http://127.0.0.1/",
+                                                      "bar.Bar", BAR_CLASS,
+                                                      null);
+        checkPerms(perms2, GRANTED_PERMS);
+        assert(perms1.equals(perms2));
 
         // check that class signed by baz is granted an additional permission
         Certificate[] chain = new Certificate[] {getCert(BAZ_CERT)};
--- a/test/jdk/java/security/SecureClassLoader/DefineClass.policy	Thu May 23 18:43:47 2019 +0200
+++ b/test/jdk/java/security/SecureClassLoader/DefineClass.policy	Thu May 23 09:03:58 2019 -0700
@@ -9,14 +9,6 @@
 grant codebase "http://127.0.0.1/" {
     permission java.util.PropertyPermission "user.name", "read";
 };
-grant codebase "http://[::1]/" {
-    permission java.util.PropertyPermission "user.name", "read";
-};
 grant codebase "http://localhost/", signedby "baz" {
     permission java.util.PropertyPermission "user.dir", "read";
 };
-// For IPSupport
-grant codebase "file:${test.classes}/../../../../test/lib/-" {
-    permission java.net.SocketPermission "localhost:0", "listen,resolve";
-    permission java.util.PropertyPermission "java.net.preferIPv4Stack", "read";
-};