RuntimeExceptions are supposed to pass through; they are not caught by the MethodInvocation. Checked exceptions are caught, and turn on the didThrowCheckedException flag. Is it possible that the exception you threw was caught and rethrown as a checked exception?
On Mon, Nov 19, 2012 at 1:59 AM, fmaylinch <ferranmayli...@gmail.com> wrote: > Hello, > > We implemented a method advisor to handle transactions and found that the > method *MethodInvocation.didThrowCheckedException* returns true when the > advised method throws a *RuntimeException*. Is this the expected behaviour? > > Since we didn't expect that, we did this workaround: > > private class TransactionMethodAdvice implements MethodAdvice > { > @Override > public void advise(MethodInvocation invocation) > { > ... > > if (invocation.didThrowCheckedException()) > { > // TODO: Tapestry bug?? > final RuntimeException rtEx = > > invocation.getCheckedException(RuntimeException.class); > if (rtEx != null) > throw rtEx; > else > invocation.rethrow(); > } > > ... > } > } > > > > > -- > View this message in context: > http://tapestry.1045711.n5.nabble.com/MethodInvocation-didThrowCheckedException-returns-true-when-there-is-a-RuntimeException-tp5718086.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com