You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Craig Blake (JIRA)" <ax...@ws.apache.org> on 2005/03/24 18:24:28 UTC

[jira] Commented: (AXIS-1870) ClassUtils delegates classloading when it shouldn't.

     [ http://issues.apache.org/jira/browse/AXIS-1870?page=comments#action_61501 ]
     
Craig Blake commented on AXIS-1870:
-----------------------------------

I came across it while investigating some other odd behavior, but it doesn't affect any of my production code.  Is it the intended behavior of the utility?  Though it is unlikely that it will affect many people, I believe it could be an issue when manually managing classloaders, particularly as it could cause hard to track down class cast exceptions within the Axis code, one of which I am also trying to track down (and which I believe may be caused by a similar unintentional misuse of the class loading facility).

> ClassUtils delegates classloading when it shouldn't.
> ----------------------------------------------------
>
>          Key: AXIS-1870
>          URL: http://issues.apache.org/jira/browse/AXIS-1870
>      Project: Axis
>         Type: Bug
>     Reporter: Craig Blake

>
> During the process of determining which classloader to use in loading a class reflectively, the application ends up delegating to the bootstrap classloader unintentionally.  When the utility first looks for the explicitly mapped classloader by classname, is passes the result to the Class.forName() call immediately without first checking for a null value.  The Javadocs state that if null is passed as the classloader argument then the bootstrap classloader is used.  I believe the code should be changed to check for null before attempting to load the class with a mapped classloader, thereby allowing the class to be loaded normally through the context classloader or the default classloader:
> if ( classLoader != null) return Class.forName(className, true, classLoader);

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira