-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Refine ModelAttributeMethodProcessor
Kotlin exception handling
#23846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
First, sorry for the delay for a response. For For I will discuss with the team if there is something to refine here or not. |
We can potentially try to wrap it for Kotlin parameter use case, I will give it a try and see how it goes. |
ModelAttributeMethodProcessor
Kotlin exception handling
…sult) constructor gh-23846 introduced a new MethodArgumentNotValidException(Executable, BindingResult) constructor that can be advantageously replaced by using MethodArgumentNotValidException(MethodParameter, BindingResult) in ModelAttributeMethodProcessor. This commit updates ModelAttributeMethodProcessor accordingly, and deprecates MethodArgumentNotValidException(Executable, BindingResult) in favor of MethodArgumentNotValidException(MethodParameter, BindingResult). Closes gh-30558
I have a kotlin class with a non-nullable property, which is not using a primitive type in the jvm, and I'm trying to use the properties of that class as request parameters. If I don't include that property as a request parameter, I would expect a bad request response. However, it instead crashes with this exception:
This is the code I'm using:
If
a
is of typeInt
instead, or if I use a non-nullableString
directly in the arguments totest
as aRequestParam
, I get a bad request as expected.The text was updated successfully, but these errors were encountered: