BEGIN java.util.ArrayList#size()
END java.util.ArrayList#size() : 0
BEGIN java.util.Date#getTime()
END java.util.Date#getTime() : 0
BEGIN java.util.Date#hashCode()
BEGIN java.util.Date#getTime()
END java.util.Date#getTime() : 0
END java.util.Date#hashCode() : 0
package examples.aop.throwsinterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.seasar.framework.aop.interceptors.ThrowsInterceptor;
import org.seasar.framework.exception.SRuntimeException;
public class HandleThrowableInterceptor extends ThrowsInterceptor {
public void handleThrowable(NullPointerException t, MethodInvocation invocation)
throws Throwable {
throw new SRuntimeException("ESSR0007", new Object[] { "引数" });
}
}
先ほど作成した実行ファイルを使って実行します。
実行結果
エラーメッセージが変わっているのが確認できます。
foo
org.seasar.framework.exception.SRuntimeException: [ESSR0007]引数はnullあるいは空であってはいけません
at examples.aop.throwsinterceptor.HandleThrowableInterceptor.
handleThrowable(HandleThrowableInterceptor.java:11)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.seasar.framework.aop.interceptors.ThrowsInterceptor.invoke(ThrowsInterceptor.java:55)
at org.seasar.framework.aop.impl.MethodInvocationImpl.proceed(MethodInvocationImpl.java:60)
at org.seasar.framework.aop.proxy.AopProxy.intercept(AopProxy.java:123)
at examples.aop.throwsinterceptor.Checker$$EnhancerByCGLIB$$8cdef299.check(<generated>)
at examples.aop.throwsinterceptor.AopCheckerClient.main(AopCheckerClient.java:13)
Exception in thread "main"