1
0

Fix addressing null pointer when logging is loaded by boot classloader for JRE's that return a null classloader in this situtation. Issue #31710. Patch contributed by David Ferrero.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@139052 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Burrell Donkin
2004-10-17 09:14:10 +00:00
parent 86b1ee0eab
commit 433ad87cd1

View File

@@ -63,7 +63,7 @@ import org.apache.commons.logging.LogFactory;
* @author Rod Waldhoff * @author Rod Waldhoff
* @author Craig R. McClanahan * @author Craig R. McClanahan
* @author Richard A. Sitze * @author Richard A. Sitze
* @version $Revision: 1.34 $ $Date: 2004/10/17 09:02:48 $ * @version $Revision: 1.35 $ $Date: 2004/10/17 09:14:10 $
*/ */
public class LogFactoryImpl extends LogFactory { public class LogFactoryImpl extends LogFactory {
@@ -371,8 +371,11 @@ public class LogFactoryImpl extends LogFactory {
Class logClass = null; Class logClass = null;
Class logInterface = null; Class logInterface = null;
try { try {
logInterface = this.getClass().getClassLoader().loadClass ClassLoader cl = this.getClass().getClassLoader();
(LOG_INTERFACE); // 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); logClass = loadClass(logClassName);
if (logClass == null) { if (logClass == null) {
throw new LogConfigurationException throw new LogConfigurationException