|
|
|
@ -350,7 +350,7 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe |
|
|
|
* Invoke the event listener method with the given argument values. |
|
|
|
* Invoke the event listener method with the given argument values. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
|
protected Object doInvoke(Object... args) { |
|
|
|
protected Object doInvoke(@Nullable Object... args) { |
|
|
|
Object bean = getTargetBean(); |
|
|
|
Object bean = getTargetBean(); |
|
|
|
// Detect package-protected NullBean instance through equals(null) check
|
|
|
|
// Detect package-protected NullBean instance through equals(null) check
|
|
|
|
if (bean.equals(null)) { |
|
|
|
if (bean.equals(null)) { |
|
|
|
@ -416,8 +416,8 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe |
|
|
|
* the given error message. |
|
|
|
* the given error message. |
|
|
|
* @param message error message to append the HandlerMethod details to |
|
|
|
* @param message error message to append the HandlerMethod details to |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected String getDetailedErrorMessage(Object bean, String message) { |
|
|
|
protected String getDetailedErrorMessage(Object bean, @Nullable String message) { |
|
|
|
StringBuilder sb = new StringBuilder(message).append('\n'); |
|
|
|
StringBuilder sb = (StringUtils.hasLength(message) ? new StringBuilder(message).append('\n') : new StringBuilder()); |
|
|
|
sb.append("HandlerMethod details: \n"); |
|
|
|
sb.append("HandlerMethod details: \n"); |
|
|
|
sb.append("Bean [").append(bean.getClass().getName()).append("]\n"); |
|
|
|
sb.append("Bean [").append(bean.getClass().getName()).append("]\n"); |
|
|
|
sb.append("Method [").append(this.method.toGenericString()).append("]\n"); |
|
|
|
sb.append("Method [").append(this.method.toGenericString()).append("]\n"); |
|
|
|
@ -431,7 +431,7 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe |
|
|
|
* beans, and others). Event listener beans that require proxying should prefer |
|
|
|
* beans, and others). Event listener beans that require proxying should prefer |
|
|
|
* class-based proxy mechanisms. |
|
|
|
* class-based proxy mechanisms. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void assertTargetBean(Method method, Object targetBean, Object[] args) { |
|
|
|
private void assertTargetBean(Method method, Object targetBean, @Nullable Object[] args) { |
|
|
|
Class<?> methodDeclaringClass = method.getDeclaringClass(); |
|
|
|
Class<?> methodDeclaringClass = method.getDeclaringClass(); |
|
|
|
Class<?> targetBeanClass = targetBean.getClass(); |
|
|
|
Class<?> targetBeanClass = targetBean.getClass(); |
|
|
|
if (!methodDeclaringClass.isAssignableFrom(targetBeanClass)) { |
|
|
|
if (!methodDeclaringClass.isAssignableFrom(targetBeanClass)) { |
|
|
|
@ -443,7 +443,7 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String getInvocationErrorMessage(Object bean, String message, Object[] resolvedArgs) { |
|
|
|
private String getInvocationErrorMessage(Object bean, @Nullable String message, @Nullable Object[] resolvedArgs) { |
|
|
|
StringBuilder sb = new StringBuilder(getDetailedErrorMessage(bean, message)); |
|
|
|
StringBuilder sb = new StringBuilder(getDetailedErrorMessage(bean, message)); |
|
|
|
sb.append("Resolved arguments: \n"); |
|
|
|
sb.append("Resolved arguments: \n"); |
|
|
|
for (int i = 0; i < resolvedArgs.length; i++) { |
|
|
|
for (int i = 0; i < resolvedArgs.length; i++) { |
|
|
|
|