Class<?> targetClass = targetObject == null ? m.getDeclaringClass()
: targetObject.getClass();
// Retrieve the exceptions declared in the throws clause of the
// intercepted method
Class<?>[] declaredExceptions = m.getExceptionTypes();
ExceptionWrapping wrappingAnnotation = AnnotationUtil.findAnnotation(m,
targetClass, ExceptionWrapping.class);
ExceptionWrap[] wraps = null;
Object ret;
boolean doWrapping = true;
if (wrappingAnnotation == null) {
throw new IllegalStateException(
"The interceptor annotation can not be determined!");
}
wraps = wrappingAnnotation.value();
// Only try to do wrapping when exceptionWrap elements are available
doWrapping = wraps != null && wraps.length > 0;
try {