You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "David Smiley (JIRA)" <ji...@apache.org> on 2006/12/07 23:09:22 UTC

[jira] Commented: (LOGGING-25) [logging] call to getClassLoader() in LogFactoryImpl not checked for null

    [ http://issues.apache.org/jira/browse/LOGGING-25?page=comments#action_12456614 ] 
            
David Smiley commented on LOGGING-25:
-------------------------------------

This hasn't been fixed.  This problem can be seen using Apple's VM on Mac OS X if JCL is on the bootclasspath (such as via -Xbootclasspath).  I looked in source control for JCL and I see that the result is not checked for null.  The reference is:
LogFactory.getClassLoader(classname).
What needs to happen is that the result in there needs to be checked for null, and if it is then return ClassLoader.getSystemClassLoader().  At least there is only one place to make this fix now that all of JCL uses this method to get a ClassLoader, unlike how it used to work.

> [logging] call to getClassLoader() in LogFactoryImpl not checked for null
> -------------------------------------------------------------------------
>
>                 Key: LOGGING-25
>                 URL: http://issues.apache.org/jira/browse/LOGGING-25
>             Project: Commons Logging
>          Issue Type: Bug
>    Affects Versions: 1.0.4
>         Environment: Operating System: other
> Platform: Other
>            Reporter: Luke Sleeman
>
> In line 374 of LogFactoryImpl.java getClassLoader() is called:
> logInterface = this.getClass().getClassLoader().loadClass(LOG_INTERFACE);
> However, the docs for getClassLoader() state that some implementations may use
> null to return the system classloader.  This occurs under CrEme a JVM for the
> PocketPC platform which some of our products run under, causing a null pointer
> exception.  Perhaps it would be better to change line 374 to read:
> logClass = loadClass(LOG_INTERFACE);
> which seems to solve the problems I have been having.  At any rate calls to
> getClassLoader() should be checked to ensure that they haven't returned null.
> In addition the error that I got:
> org.apache.commons.logging.LogConfigurationException:
> org.apache.commons.logging.LogConfigurationException:
> java.lang.NullPointerException (Caused by java.lang.NullPointerException)
> (Caused by org.apache.commons.logging.LogConfigurationException:
> java.lang.NullPointerException (Caused by java.lang.NullPointerException))
> Certianly wasnt very helpfull for figuring out what is going on.
> - Luke

-- 
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
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org