donaldp     01/12/03 01:24:23

  Modified:    src/java/org/apache/avalon/excalibur/logger
                        DefaultLogTargetFactoryManager.java
  Log:
  Made it so that the creation of factorys is initially attempted using the 
COntextClassLoader if available. If that fails then it falls back onto the 
ClassLoader that loaded this class.
  
  This is absed on a modified patch by "Leo Sutic" <[EMAIL PROTECTED]>
  
  Revision  Changes    Path
  1.4       +18 -3     
jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/logger/DefaultLogTargetFactoryManager.java
  
  Index: DefaultLogTargetFactoryManager.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/logger/DefaultLogTargetFactoryManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultLogTargetFactoryManager.java       2001/11/19 02:15:39     1.3
  +++ DefaultLogTargetFactoryManager.java       2001/12/03 09:24:23     1.4
  @@ -23,7 +23,7 @@
    * from a configuration file.
    *
    * @author <a href="mailto:[EMAIL PROTECTED],org">Giacomo Pati</a>
  - * @version CVS $Revision: 1.3 $ $Date: 2001/11/19 02:15:39 $
  + * @version CVS $Revision: 1.4 $ $Date: 2001/12/03 09:24:23 $
    * @since 4.0
    */
   public class DefaultLogTargetFactoryManager
  @@ -83,8 +83,23 @@
               final LogTargetFactory logTargetFactory;
               try
               {
  -                logTargetFactory = 
  -                    (LogTargetFactory) 
this.getClass().getClassLoader().loadClass( factoryClass ).newInstance();
  +                Class clazz = null;
  +
  +                //First lets try the context ClassLoader
  +                final ClassLoader classLoader = 
Thread.currentThread().getContextClassLoader();
  +                if( null != classLoader )
  +                {
  +                    try { clazz = classLoader.loadClass( factoryClass ); }
  +                    catch( final ClassNotFoundException cnfe ) {}
  +                }
  +
  +                //Okay now lets try classLoader this class was loaded from
  +                if( null == clazz )
  +                {
  +                    clazz = getClass().getClassLoader().loadClass( 
factoryClass );
  +                }
  +
  +                logTargetFactory = (LogTargetFactory)clazz.newInstance();
               }
               catch( final ClassNotFoundException cnfe )
               {
  
  
  

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

Reply via email to