shiro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jared Bunting <>
Subject Re: Handling exceptions thrown by @Requires* annotations
Date Fri, 12 Aug 2011 22:11:05 GMT
I believe the reason (it's been awhile) that I overrode 'cleanup' is
because I didn't want the exception to be rethrown.  Off the top of my
head, I'm not sure if that will suppress the redirect or not, but I
wanted the distinct behavior of my filter "handling" the exception.

Basically, the way that 'afterCompletion' is invoked feels more like a
'finally' and what I wanted was a 'catch'.  However, like I said, it's
been awhile, and there's a chance that I completely misjudged how that
would play out.


On 08/10/2011 04:06 PM, Les Hazlewood wrote:
> Jared's solution is definitely the right way to think of this, but I'd
> personally override the 'afterCompletion' method in the AdviceFilter
> superclass instead of 'cleanup'.
> 'cleanup' calls 'afterCompletion' in all cases, and will additionally
> handle any extraneous/unexpected exceptions that might be thrown from
> 'afterCompletion'.  And there is no need to call  In this
> way I think it is a bit safer/more convenient to override
> afterCompletion rather than cleanup.  This is just my preference
> however.
> Cheers,
> Les

View raw message