public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {\r
try {\r
return super.invoke(proxy, method, args);\r
- }catch (Throwable t) {\r
+ }catch (Exception t) {\r
Throwable exception = t;\r
if (t instanceof InvocationTargetException) {\r
- InvocationTargetException it = (InvocationTargetException)t;\r
- exception = it.getCause()!=null?it.getCause():it;\r
+ exception = t.getCause()!=null?t.getCause():t;\r
} \r
Class<?> exceptionClass = exception.getClass();\r
if (!isDeclaredException(method, exceptionClass)) {\r
\r
public boolean isDeclaredException(Method m, Class<?> clazz) {\r
for (Class<?> cl : m.getExceptionTypes()) {\r
- if (cl.equals(clazz)) return true;\r
+ if (cl.equals(clazz) || cl.isAssignableFrom(clazz)) return true;\r
}\r
return false;\r
}\r