Hi BCEL users, I wanted to do some stuff where I inject code into java.net.URL. When I
first tried it, java.lang.Classloader.defineClass(String s, byte abyte0[], int i, int
j, ProtectionDomain protectiondomain) threw a Security Exception. So... I commented
out this line inside of java.lang.Classloader
if(s != null && s.startsWith("java."))
throw new SecurityException("Prohibited package name: " + s.substring(0,
s.lastIndexOf('.')));
This took care of the security exception and it returned a Class object. However, when
I tried to instantiate the URL object, I get this error:
java.lang.IllegalAccessError: try to access method
java.net.URLStreamHandler.parseURL(Ljava/net/URL;Ljava/lang/String;II)V from class
java.net.URL at java.net.URL.<init>(URL.java:145) at java.net.URL.<init>(URL.java:76)
at java.net.URL.<init>(URL.java:70) at
net.nvisionsoftware.DynamicJavaMon.gui.T2.main(T2.java:30)
Any idea what's going on or how I can actually inject code into java.* classes? Thanks,
--Abel