Skip to content
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

Use 400 Bad request instead of 500 when JSON payload is well formed but has an invalid structure [SPR-8476] #13122

Closed
spring-projects-issues opened this issue Jun 21, 2011 · 0 comments
Assignees
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Jun 21, 2011

Sébastien Launay opened SPR-8476 and commented

When the JSON payload is well formed but contains like a property that cannot be mapped to the target bean a JsonMappingException is thrown and then catch by DefaultHandlerExceptionResolver resulting in a 500.
This is not true for JsonParseException when the JSON is not well formed by wrapping the exception inside an HttpMessageNotReadableException thanks to #12097.

Unit test plus fix catching and wrapping the root exception JsonProcessingException can be found in the following patch.


Affects: 3.0.3, 3.1 M2

Attachments:

Referenced from: commits efaa941

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants