On Sunday, August 24, 2003, at 12:50 PM, Jeremy Boynes wrote:
Hmmm - thinking about it, that last bit seems to make more sense. It mirrors the distinction between 'normal' completion and a system exceptions as defined for EJBs; it makes the code for the interceptors simpler; it allows us to add meta-values to any normal completion and although we can't add them to system exceptions I don't think that's a big downside.
So the CallbackInterceptor would then be
try { Object result = callbackMethod.invoke(instance, callbackArgs); return new SimpleInvocationResult(result); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); if (cause instanceof Exception && !(cause instanceof RuntimeException)) { return new SimpleInvocationResult((Exception)cause)); } else { throw cause; } }
and the code David had above would work nicely.
Any objections?
No. I have completely flip flopped on this issue. After yet another read of the exception chapter from the EJB specification, it is clear that to the container an application exception is an normal okay result from an EJB. The spec treats application exceptions exactly like a normal method return, so I think packing the application exception in the invocation response object is the right thing to do.
-dain
************************* * Dain Sundstrom * Partner * Core Developers Network *************************/
