1 package examples.exception;2 3 import org.codehaus.aspectwerkz.joinpoint.JoinPoint;4 import org.codehaus.aspectwerkz.joinpoint.CatchClauseRtti;5 import org.codehaus.aspectwerkz.joinpoint.Rtti;6 7 /**8 * @author <a HREF="mailto:jboner@codehaus.org">Jonas BonŽr </a>9 */10 public class ExceptionHandlingAspect {11 12 /**13 * before handler(java.lang.Exception) && withincode(public static void14 * examples.exception.Target.main(String[]))15 *16 * @Before handler(java.lang.Exception) && within(examples.exception.Target)17 */18 public void logEntry(final JoinPoint joinPoint) throws Throwable {19 CatchClauseRtti crtti = (CatchClauseRtti) joinPoint.getRtti();20 Exception e = (Exception ) crtti.getParameterValue();21 System.out.println("[From advice] exception catched:" + e.toString());22 }23 }