changeset 28682:6c7c7cad5e64

8068578: test/java/io/Serializable/subclassGC/SubclassGC.java assumes app class loader is a URLClassLoader Reviewed-by: alanb
author bchristi
date Thu, 29 Jan 2015 14:49:15 -0800
parents fc0698dfbb23
children a36c179aa292
files jdk/test/java/io/Serializable/subclassGC/SubclassGC.java jdk/test/java/io/Serializable/subclassGC/security.policy
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/test/java/io/Serializable/subclassGC/SubclassGC.java	Thu Jan 29 20:45:30 2015 +0000
+++ b/jdk/test/java/io/Serializable/subclassGC/SubclassGC.java	Thu Jan 29 14:49:15 2015 -0800
@@ -50,8 +50,9 @@
                 }
 
                 ClassLoader systemLoader = ClassLoader.getSystemClassLoader();
-                ClassLoader loader = new URLClassLoader(((URLClassLoader) systemLoader).getURLs(),
-                                                                                        systemLoader.getParent());
+                URL testClassesURL = new File(System.getProperty("test.classes")).toURI().toURL();
+                ClassLoader loader = new URLClassLoader(new URL[] { testClassesURL } ,
+                                                        systemLoader.getParent());
                 Class<? extends ObjectOutputStream> cl =
                         Class.forName(SubclassOfOOS.class.getName(), false,
                                                   loader).asSubclass(ObjectOutputStream.class);
--- a/jdk/test/java/io/Serializable/subclassGC/security.policy	Thu Jan 29 20:45:30 2015 +0000
+++ b/jdk/test/java/io/Serializable/subclassGC/security.policy	Thu Jan 29 14:49:15 2015 -0800
@@ -2,5 +2,7 @@
 grant {
 	permission java.lang.RuntimePermission "createClassLoader";
 	permission java.lang.RuntimePermission "getClassLoader";
+	permission java.util.PropertyPermission "test.classes", "read";
+	permission java.io.FilePermission "<<ALL FILES>>", "read";
 };