You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Eric Pugh <ep...@upstate.com> on 2003/09/11 17:02:49 UTC

Got Proof! Was RE: Is Turbine.java eating an extra exception?

Hi all,

I just committed a unit test that proves that ActionLoader deals with
default doPerform events differently from doMyevent in ActionEvents.

Currently, the doPerform event properly throws an exception that turbine
deals with by looking up the error screen.  But, if it is a doSomething
style
event, it eats the exception!

I believe VelocityActionEvent needs to throw an exception here:
catch (InvocationTargetException ite)
        {
            Throwable t = ite.getTargetException();
            log.error("Invokation of " + method , t);
        }

I wanted to run it by those who really grok the whole event stuff!

Eric Pugh



> -----Original Message-----
> From: Eric Pugh [mailto:epugh@upstate.com]
> Sent: Thursday, September 11, 2003 10:17 AM
> To: 'Turbine Developers List'
> Subject: Is Turbine.java eating an extra exception?
>
>
> Hi all,
>
> I am updating an app from some older 2.3 dev version.  In my
> various actions
> I always just throw any exception.  And previously they where
> trapped, and
> the user recieved my Error.vm page specified in TR.props:
> template.error=Error.vm
>
> Now, i upgraded to 2.3, and when my action event that throws
> an exception
> happens, the enclosing VelocityActionEvent class catches it as an
> InvocationTargetException ite.  That means it never gets
> thrown out of the
> VelocityActionEvent to Turbine.java where the catch statement would
> previously
>
>
> Here is the offending code (around line 190 of
> VelocityActionEvent.java):
>
>  try
>         {
>             method = getClass().getMethod(theButton, methodParams);
>             Object[] methodArgs = new Object[] { data, context };
>
>             if (log.isDebugEnabled())
>             {
>                 log.debug("Invoking " + method);
>             }
>
>             method.invoke(this, methodArgs);
>         }
>      <snip>
>         catch (InvocationTargetException ite)
>         {
>             Throwable t = ite.getTargetException();
>             log.error("Invokation of " + method , t);
>         }
>
> Therefore, the handleException method of Turbine.java never
> recieves the
> Exception, and setting the screen to the template.error never happens!
>
> It seems like tiher the InvocationTargetException should be
> rethrown, or the
> InvocationTargetException should then check for template.error...?
>
> Eric Pugh
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org