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:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -170,7 +170,8 @@ public class InvocableHandlerMethod extends HandlerMethod {
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
assertTargetBean(getBridgedMethod(), 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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user