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 10:17:04 UTC

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


Re: Is Turbine.java eating an extra exception?

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
"Eric Pugh" <ep...@upstate.com> writes:

>Hi all,

ReHi,

I put that ITE in there. I didn't think that using the "uh, an error
happened" path is actually used in an application and preferred
getting the error into the log.

But yes, we should make this configureable (I prefer to keep my app
running, because having an action throw an exception "up" into Turbine
means that my error processing has already broken down).

>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

So you use the Error.vm for some meaningful error message or just
"This action is not allowed at this point" messages?

	Regards
		Henning



-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

Java, perl, Solaris, Linux, xSP Consulting, Web Services 
freelance consultant -- Jakarta Turbine Development  -- hero for hire

"Dominate!! Dominate!! Eat your young and aggregate! I have grotty silicon!" 
      -- AOL CD when played backwards  (User Friendly - 200-10-15)

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

Posted by Eric Pugh <ep...@upstate.com>.
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