This week's book giveaways are in the iOS and Features new in Java 8 forums. We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line! See this thread and this one for details.
Sort of. Not at catching line, but you can create an afterThrowing advice, which is a clean approach to exception handling. If your method that matches the point cut expression throws and exception, then the after throwing advice will get called.
David Newton wrote:@Mark: using Spring? I didn't know that--this could be useful; nobody lets me use compile-time AspectJ.
Yep Spring AOP has 5 advice types
AfterReturning, called after the target, but only if the target successfully returned.
AfterThrowing, called after the target, but only if the target throws an exception.
After, always called after the target.
Around, called before and after, but you are responsible for calling the target with a call to ProceedingJoinpoint's proceed method. And you are responsible for returning the target's return object from the advice method.
David Newton wrote:Oh, wait, maybe I knew that. I thought the OP meant within the method, not if the entire method threw.
Yep still at the beginning or end of the method. So in the catch, if they need to catch anymore, throw and exception out of the method. Same results as if you could join at the catch line in the middle of the method.