commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rsi...@apache.org
Subject cvs commit: jakarta-commons/logging/src/java/org/apache/commons/logging/impl LogFactoryImpl.java
Date Tue, 11 Jun 2002 22:47:21 GMT
rsitze      2002/06/11 15:47:21

  Modified:    logging/src/java/org/apache/commons/logging/impl
                        LogFactoryImpl.java
  Log:
  Resolve NullPointerExceptions
  
  Revision  Changes    Path
  1.11      +22 -10    jakarta-commons/logging/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java
  
  Index: LogFactoryImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/logging/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- LogFactoryImpl.java	11 Jun 2002 22:35:33 -0000	1.10
  +++ LogFactoryImpl.java	11 Jun 2002 22:47:21 -0000	1.11
  @@ -403,6 +403,10 @@
           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,21 +442,29 @@
           throws ClassNotFoundException
       {
           ClassLoader threadCL = getContextClassLoader();
  -        try {
  -            return threadCL.loadClass(name);
  -        } catch( ClassNotFoundException ex ) {
  -            return Class.forName( name );
  +        
  +        if (threadCL != null) {
  +            try {
  +                return threadCL.loadClass(name);
  +            } catch( ClassNotFoundException ex ) {
  +                return Class.forName( name );
  +            }
           }
  +
  +        return null;
       }
   
       protected void guessConfig() {
           if( isLog4JAvailable() ) {
  +            proxyFactory = null;
               try {
                   Class proxyClass=
                       loadClass( "org.apache.commons.logging.impl.Log4jFactory" );
  -                proxyFactory=(LogFactory)proxyClass.newInstance();
  +                if (proxyClass != null) {
  +                    proxyFactory = (LogFactory)proxyClass.newInstance();
  +                }
               } catch( Throwable t ) {
  -                proxyFactory=null;
  +                ; // ignore
               }
           }
           // other logger specific initialization
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message