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.
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
The text was updated successfully, but these errors were encountered: