8068578: test/java/io/Serializable/subclassGC/SubclassGC.java assumes app class loader is a URLClassLoader

Reviewed-by: alanb
This commit is contained in:
Brent Christian 2015-01-29 14:49:15 -08:00
parent 60fdd0dceb
commit 76ace03a9e
2 changed files with 5 additions and 2 deletions

View File

@ -50,8 +50,9 @@ public class SubclassGC {
}
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);

View File

@ -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";
};