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:
@@ -63,7 +63,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
* @author Rod Waldhoff
|
||||
* @author Craig R. McClanahan
|
||||
* @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 {
|
||||
@@ -371,8 +371,11 @@ public class LogFactoryImpl extends LogFactory {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user