[
https://issues.apache.org/jira/browse/LOGGING-33?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dennis Lundberg updated LOGGING-33:
-----------------------------------
Fix Version/s: 1.1.0
> getClassLoader() returns null at a critical point under certain conditions
> --------------------------------------------------------------------------
>
> Key: LOGGING-33
> URL: https://issues.apache.org/jira/browse/LOGGING-33
> Project: Commons Logging
> Issue Type: Bug
> Affects Versions: 1.0.4
> Environment: Operating System: All
> Platform: Macintosh
> Reporter: David Ferrero
> Priority: Critical
> Fix For: 1.1.0
>
> Attachments: LogFactoryImpl.java.patch.txt
>
>
> launching jakarta-tomcat 5.0.28 using the JWS (java wrapper service) via the
> Bootstrap class leads to a critical null pointer exception which points to
> code
> in LogFactoryImpl.java which expects this.getClass().getClassLoader() to
> return
> a value that's not null. The javadocs for Class state that null can be
> returned
> in some implementations if the class was loaded by the bootstrap classloader.
> I
> have a patch file but am not sure how to submit it as an attachment so here it
> is below:
> Index: LogFactoryImpl.java
> ===================================================================
> RCS file:
> /home/cvspublic/jakarta-commons/logging/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java,v
> retrieving revision 1.33
> diff -u -u -r1.33 LogFactoryImpl.java
> --- LogFactoryImpl.java 6 Mar 2004 21:52:59 -0000 1.33
> +++ LogFactoryImpl.java 13 Oct 2004 20:54:02 -0000
> @@ -371,8 +371,12 @@
> Class logClass = null;
> Class logInterface = null;
> try {
> - logInterface = this.getClass().getClassLoader().loadClass
> - (LOG_INTERFACE);
> + ClassLoader cl = this.getClass().getClassLoader();
> + // handle the case if getClassLoader() returns null
> + // It may mean this class was loaded from the bootstrap
> classloader
> + logInterface = (cl == null) ? loadClass(LOG_INTERFACE) :
> + cl.loadClass(LOG_INTERFACE);
> +
> logClass = loadClass(logClassName);
> if (logClass == null) {
> throw new LogConfigurationException
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.