commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dennis Lundberg (JIRA)" <j...@apache.org>
Subject [jira] Updated: (LOGGING-22) NullPointerException in LogFactory
Date Tue, 29 Dec 2009 16:48:29 GMT

     [ https://issues.apache.org/jira/browse/LOGGING-22?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Dennis Lundberg updated LOGGING-22:
-----------------------------------

    Fix Version/s: 1.0.3

> NullPointerException in LogFactory
> ----------------------------------
>
>                 Key: LOGGING-22
>                 URL: https://issues.apache.org/jira/browse/LOGGING-22
>             Project: Commons Logging
>          Issue Type: Bug
>    Affects Versions: Nightly Builds
>         Environment: Operating System: All
> Platform: PC
>            Reporter: Philip Mitchell
>             Fix For: 1.0.3
>
>
> Trying to run this software on an EAServer, a NullPointerException is thrown in 
> two different places within LogFactory.java.  I was able to trace the problem 
> in the source:
> 1)  private static LogFactory getCachedFactory(ClassLoader contextClassLoader)
>     {
>         LogFactory factory = null;
>         if (contextClassLoader != null)
>             factory = (LogFactory) factories.get(contextClassLoader);
>         if (factory==null)
>             factory = (LogFactory) factories.get(LogFactory.class.getClassLoader
> ());
>         return factory;
>     }
> the factories.get(LogFactory.class.getClassLoader()) will cause a problem 
> because LogFactory.class.GetClassLoader() is null (using jre 1.4)  changing 
> that part to a call to getContextClassLoader() would resolve this bug.
> 2) in getFactory():
>         // Fourth, try the fallback implementation class
>         if (factory == null) {
>             factory = newFactory(FACTORY_DEFAULT, 
> LogFactory.class.getClassLoader());
>         }
> same deal here, replacing LogFactory.class.getClassLoader() with contextClass 
> will fix.
> I don't know if there was a reason these were left as 
> LogFactory.class.getClassLoader(), but getContextClassLoader(), will determine 
> if this is the correct call to make (and it states that this is only 
> appropriate in pre-jdk1.1), instead of just assuming it is the right call, 
> causing NullPointerExceptions.
> Perhaps this wasn't noticed since it usually doesn't get to this fallback 
> position, but on the application server, it does every time.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message