8068578: test/java/io/Serializable/subclassGC/SubclassGC.java assumes app class loader is a URLClassLoader
Reviewed-by: alanb
--- 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";
};