jmcnally    02/05/09 14:46:42

  Modified:    src/java/org/apache/turbine/modules ActionEvent.java
  Log:
  i have been seeing a lot of stacktraces with useless
  info due to the original being wrapped in an
  InvocationTargetException.  I suspect sun's jdk1.4 might
  have a bug in its printStackTrace() method.  But
  regardless, we can unwrap it so we do not lose the info.
  
  Revision  Changes    Path
  1.4       +27 -1     
jakarta-turbine-3/src/java/org/apache/turbine/modules/ActionEvent.java
  
  Index: ActionEvent.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/modules/ActionEvent.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ActionEvent.java  5 Mar 2002 05:23:18 -0000       1.3
  +++ ActionEvent.java  9 May 2002 21:46:42 -0000       1.4
  @@ -57,8 +57,10 @@
   import org.apache.turbine.Turbine;
   import org.apache.turbine.RunData;
   import java.lang.reflect.Method;
  +import java.lang.reflect.InvocationTargetException;
   import java.util.Enumeration;
   import org.apache.turbine.ParameterParser;
  +import org.apache.turbine.TurbineException;
   
   /**
    * <p>
  @@ -100,7 +102,7 @@
    * method naming in your Action class.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jon S. Stevens </a>
  - * @version $Id: ActionEvent.java,v 1.3 2002/03/05 05:23:18 jon Exp $
  + * @version $Id: ActionEvent.java,v 1.4 2002/05/09 21:46:42 jmcnally Exp $
    */
   public abstract class ActionEvent
       extends Action
  @@ -143,6 +145,30 @@
           catch (NoSuchMethodException e)
           {
               doPerform( data );
  +        }
  +        catch (InvocationTargetException ite)
  +        {
  +            // i have not seen this exception, in stacktraces generated
  +            // while doing my own testing on jdk1.3.1 and earlier.  But
  +            // see it increasingly from stacktraces reported by others.
  +            // Its printStackTrace method should do The Right Thing, but
  +            // I suspect some implementation is not.
  +            // Unwrap it here, so that the original cause does not get lost.
  +            Throwable t = ite.getTargetException();
  +            if (t instanceof Exception) 
  +            {
  +                throw (Exception)t;
  +            }
  +            else if (t instanceof java.lang.Error) 
  +            {
  +                throw (java.lang.Error)t;
  +            }
  +            else 
  +            {
  +                // this should not happen, but something could throw
  +                // an instance of Throwable
  +                throw new TurbineException(t);
  +            }
           }
       }
   
  
  
  

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

Reply via email to