Not throwing exception when reflection utils can't access a method
without this change when ReflectionUtils are having a problem with accessing method (cause it's private), an exception is thrown and wrapping of an executor will not take place with this change we catch such an exception and ignore it related to gh-1453
This commit is contained in:
@@ -282,13 +282,21 @@ class ExecutorBeanPostProcessor implements BeanPostProcessor {
|
||||
}
|
||||
|
||||
private static <T> boolean anyFinalMethods(T object, Class<T> iface) {
|
||||
for (Method method : ReflectionUtils.getDeclaredMethods(iface)) {
|
||||
Method m = ReflectionUtils.findMethod(object.getClass(), method.getName(),
|
||||
method.getParameterTypes());
|
||||
if (m != null && Modifier.isFinal(m.getModifiers())) {
|
||||
return true;
|
||||
try {
|
||||
for (Method method : ReflectionUtils.getDeclaredMethods(iface)) {
|
||||
Method m = ReflectionUtils.findMethod(object.getClass(), method.getName(),
|
||||
method.getParameterTypes());
|
||||
if (m != null && Modifier.isFinal(m.getModifiers())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IllegalAccessError er) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Error occurred while trying to access methods", er);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user