Improve InvocableHandlerMethod error handling

This commit improves the fix for gh-18491 for Java 18 as in this case
the exception message might not be null.
This commit is contained in:
Brian Clozel
2022-09-09 20:20:29 +02:00
parent 1dc3d5d2d6
commit 1051fe7bee
2 changed files with 5 additions and 3 deletions

View File

@@ -206,7 +206,8 @@ public class InvocableHandlerMethod extends HandlerMethod {
}
catch (IllegalArgumentException ex) {
assertTargetBean(method, getBean(), args);
String text = (ex.getMessage() != null ? ex.getMessage() : "Illegal argument");
String text = (ex.getMessage() == null || ex.getCause() instanceof NullPointerException)
? "Illegal argument": ex.getMessage();
throw new IllegalStateException(formatInvokeError(text, args), ex);
}
catch (InvocationTargetException ex) {