It looks like (from the bud db) that sun thinks this is not a bug: 
http://developer.java.sun.com/developer/bugParade/bugs/4452033.html

Or perhaps they have not been clued into how existing classes inside the 
JRE which use this are causing problems.

Looks like there is no way to get around this for our custom cl with 
protocol handlers at the very least.  SInce, URL.getURLStreamHandler() 
calls Class.forName(), which will:

   return forName0(className, true, ClassLoader.getCallerClassLoader());

If I understand this correctly, then the return of 
ClassLoader.getCallerClassLoader() will be the system or rather bootsrap 
CL, since that is what has loaded URL (URL.class.getClassLoader() 
returns null).

So any attempt to Class.forName() done in URL will only succeed in load 
classed from the bootstrap cl.

Back in URL, after failing to Class.forName() it will try the system cl 
and then give up.

Looks like unless there are class on the system or bootstrap cl then 
Class.forName() just won't work.

I guess they don't think this is a bug because you can use the 
forName(String name, boolean initialize, ClassLoader loader)  method... 
but I think lots of folks don't think about the possibility that there 
classes might not loaded from the system cl.

URL should be fixed to load from TCL which should fix this problem, but 
we should also becareful where we use Class.forName(String).

--jason


_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to