rdonkin     2004/10/17 02:14:11

  Modified:    logging/src/java/org/apache/commons/logging/impl
                        LogFactoryImpl.java
  Log:
  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.
  
  Revision  Changes    Path
  1.35      +6 -3      
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.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- LogFactoryImpl.java       17 Oct 2004 09:02:48 -0000      1.34
  +++ LogFactoryImpl.java       17 Oct 2004 09:14:10 -0000      1.35
  @@ -371,8 +371,11 @@
           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
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to