NullPointerException while building error message in InvocableHandlerMethod [SPR-13917] #18491
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
Milestone
lionel b opened SPR-13917 and commented
Hello,
I have a problem when I try to call my resource,
Here is my signature :
As you see, the second argument ("amount") is a primitive type.
Using the controller, the org.springframework.web.method.support.InvocableHandlerMethod tries to get my method and to invoke it with some arguments parsed from my argresolver.
If I try to pass nothing for the "amount" value, the null value will be selected, and therefore the InvocableHandlerMethod will invoke the method with a null amount, which is forbidden by the fact that the double class is primitive. That is okay and logical.
Then I get an IllegalArgumentException from the java.lang.reflect API. The message of this exception is null. The InvocableHandlerMethod.getInvocationErrorMessage is called. It is fine.
4)This method passes this null String to the InvocableHandlerMethod.getDetailedErrorMessage method, ok.
5)Then this method calls new "StringBuilder(message)", which is resolved to do "new StringBuilder(null)"
=> I expect the null message to be ignored
... But instead, I get a NullPointerException
Can you help me ?
Regards,
Lionel.
Source code of the InvocableHandlerMethod class in the spring web framework :
https://github.com/spring-projects/spring-framework/blob/master/spring-web/src/main/java/org/springframework/web/method/support/InvocableHandlerMethod.java
Affects: 3.2.16, 4.2.1
Backported to: 3.2.17
The text was updated successfully, but these errors were encountered: