You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by cr...@apache.org on 2004/03/06 22:25:36 UTC

cvs commit: jakarta-commons/logging/src/java/org/apache/commons/logging/impl LogFactoryImpl.java

craigmcc    2004/03/06 13:25:36

  Modified:    logging  RELEASE-NOTES.txt
               logging/src/java/org/apache/commons/logging/impl
                        LogFactoryImpl.java
  Log:
  If an InvocationTargetException is thrown during the construction of a new
  Log instance, unwrap it so that the message on the LogConfigurationException
  identifies the actual cause of the problem.
  
  PR:  Bugzilla #26598
  Submitted By:  Brian Curnow <bcurnow AT gfs DOT com>
  
  Revision  Changes    Path
  1.5       +7 -1      jakarta-commons/logging/RELEASE-NOTES.txt
  
  Index: RELEASE-NOTES.txt
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/logging/RELEASE-NOTES.txt,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RELEASE-NOTES.txt	28 Feb 2004 23:20:57 -0000	1.4
  +++ RELEASE-NOTES.txt	6 Mar 2004 21:25:36 -0000	1.5
  @@ -69,6 +69,12 @@
   [LogFactory]       Improve usability of error messages reporting
                      configuration problems.
   
  +[LogFactoryImpl]   If an InvocationTargetException is returned during the
  +                   creation of a new Log instance, unwrap the underlying
  +                   cause and pass it in to the LogConfigurationException
  +                   constructor.  This will make the actual cause of the
  +                   problem easier to diagnose.
  +
   [JDK14Logger]      Implement Serializable, remove "final" declaration for
                      easy subclassing.
   
  
  
  
  1.32      +9 -1      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.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- LogFactoryImpl.java	28 Feb 2004 22:16:16 -0000	1.31
  +++ LogFactoryImpl.java	6 Mar 2004 21:25:36 -0000	1.32
  @@ -18,6 +18,7 @@
   
   
   import java.lang.reflect.Constructor;
  +import java.lang.reflect.InvocationTargetException;
   import java.lang.reflect.Method;
   import java.security.AccessController;
   import java.security.PrivilegedAction;
  @@ -510,6 +511,13 @@
                   logMethod.invoke(instance, params);
               }
               return (instance);
  +        } catch (InvocationTargetException e) {
  +            Throwable c = e.getTargetException();
  +            if (c != null) {
  +                throw new LogConfigurationException(c);
  +            } else {
  +                throw new LogConfigurationException(e);
  +            }
           } catch (Throwable t) {
               throw new LogConfigurationException(t);
           }
  
  
  

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