mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 02:54:35 +02:00
8214445: [test] java/net/URL/HandlerLoop has illegal reflective access
Reviewed-by: lancea, chegar, bpb
This commit is contained in:
parent
9f88ce2b1e
commit
c03797a5d0
1 changed files with 15 additions and 12 deletions
|
@ -21,16 +21,19 @@
|
||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.*;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLStreamHandler;
|
||||||
|
import java.net.URLStreamHandlerFactory;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 4135031
|
* @bug 4135031
|
||||||
* @summary Test boostrap problem when a URLStreamHandlerFactory is loaded
|
* @summary Test bootstrap problem when a URLStreamHandlerFactory is loaded
|
||||||
* by the application class loader.
|
* by the application class loader.
|
||||||
*
|
* @modules java.base/sun.net.www.protocol.file
|
||||||
|
* @run main HandlerLoop
|
||||||
*/
|
*/
|
||||||
import java.net.*;
|
|
||||||
|
|
||||||
public class HandlerLoop {
|
public class HandlerLoop {
|
||||||
|
|
||||||
public static void main(String args[]) throws Exception {
|
public static void main(String args[]) throws Exception {
|
||||||
|
@ -57,13 +60,13 @@ public class HandlerLoop {
|
||||||
// shares the same stream handler factory.
|
// shares the same stream handler factory.
|
||||||
new Dummy();
|
new Dummy();
|
||||||
try {
|
try {
|
||||||
Class c = Class.forName(name);
|
Class<?> c = Class.forName(name);
|
||||||
return (URLStreamHandler)c.newInstance();
|
return (URLStreamHandler)c.getDeclaredConstructor().newInstance();
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException |
|
||||||
e.printStackTrace();
|
IllegalAccessException |
|
||||||
} catch (IllegalAccessException e) {
|
InstantiationException |
|
||||||
e.printStackTrace();
|
NoSuchMethodException |
|
||||||
} catch (InstantiationException e) {
|
InvocationTargetException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue