1
0

Resolve NullPointerExceptions

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@138893 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Richard A. Sitze
2002-06-11 22:47:21 +00:00
parent 2a26463d60
commit 6b15ddfe75

View File

@@ -1,7 +1,7 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java,v 1.10 2002/06/11 22:35:33 rsitze Exp $
* $Revision: 1.10 $
* $Date: 2002/06/11 22:35:33 $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java,v 1.11 2002/06/11 22:47:21 rsitze Exp $
* $Revision: 1.11 $
* $Date: 2002/06/11 22:47:21 $
*
* ====================================================================
*
@@ -104,7 +104,7 @@ import org.apache.commons.logging.LogSource;
*
* @author Rod Waldhoff
* @author Craig R. McClanahan
* @version $Revision: 1.10 $ $Date: 2002/06/11 22:35:33 $
* @version $Revision: 1.11 $ $Date: 2002/06/11 22:47:21 $
*/
public class LogFactoryImpl extends LogFactory {
@@ -403,6 +403,10 @@ public class LogFactoryImpl extends LogFactory {
Class logClass = null;
try {
logClass = loadClass(logClassName);
if (logClass == null) {
throw new LogConfigurationException
("No suitable Log implementation for " + logClassName);
}
if (!Log.class.isAssignableFrom(logClass)) {
throw new LogConfigurationException
("Class " + logClassName + " does not implement Log");
@@ -438,6 +442,8 @@ public class LogFactoryImpl extends LogFactory {
throws ClassNotFoundException
{
ClassLoader threadCL = getContextClassLoader();
if (threadCL != null) {
try {
return threadCL.loadClass(name);
} catch( ClassNotFoundException ex ) {
@@ -445,14 +451,20 @@ public class LogFactoryImpl extends LogFactory {
}
}
return null;
}
protected void guessConfig() {
if( isLog4JAvailable() ) {
proxyFactory = null;
try {
Class proxyClass=
loadClass( "org.apache.commons.logging.impl.Log4jFactory" );
if (proxyClass != null) {
proxyFactory = (LogFactory)proxyClass.newInstance();
}
} catch( Throwable t ) {
proxyFactory=null;
; // ignore
}
}
// other logger specific initialization