You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Spring MVC raises MissingPathVariableException resulting in 500 instead of 400 error when path segment is u001F or u00D and cannot be converted to target type UUID
#31382
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.
I think the the last two tests in the DemoControllerTest should return a 400(MethodArgumentTypeMismatchException) and not a 500(MissingPathVariableException) response.
The text was updated successfully, but these errors were encountered:
This case where a value is present, but becomes null after conversion (StringToUUIDConverter calls UUID.fromString) was addressed in #26679. We now detect it and raise MissingPathVariableException, which is what we do generally with missing path variables since that could be an incorrectly defined URI template.
That said in this case a value is present, but not valid and indeed should be treated as a 400. As part of #26679 we did add a missingAfterConversion flag to MissingRequestValueException and could use that to differentiate this case from the more general case of a missing path variable.
rstoyanchev
changed the title
Spring MVC throws http 500(MissingPathVariableException) instead of 400 (MethodArgumentTypeMismatchException) when u001F, u00D send as @PathVariable that cannot be matched to a type
Spring MVC raises MissingPathVariableException resulting in 500 instead of 400 error when path segment is u001F or u00D and cannot be converted to target type UUID
Oct 20, 2023
This is an corner case, discovered while performing some property-based testing for my API.
Affects spring-web:6.0.12
Here is a minimal code sample that reproduces the issue
https://gist.github.com/ltsallas/9903343b6b7a90013cdd155bfcd670ce
I think the the last two tests in the DemoControllerTest should return a 400(MethodArgumentTypeMismatchException) and not a 500(MissingPathVariableException) response.
The text was updated successfully, but these errors were encountered: