Skip to content

JSON (jackson) @RequestBody marshalling throws awkward exception [SPR-7439] #12097

Closed
@spring-projects-issues

Description

@spring-projects-issues

Daniel Robert opened SPR-7439 and commented

When utilizing a @Controller method with annotation @RequestBody and 'application/json' content type with Jackson on the classpath, MappingJacksonHttpMessageConverter throws a 'JsonParseException' (subclass of IOException) when given invalid JSON.

According to AbstractHttpMessageConverter.readInternal()'s documentation, the HttpMessageNotReadableException exception is more appropriate for conversion errors.

The side effect of this is that DefaultHandlerExceptionResolver throws a 500 Internal Server Error instead of the expected 400 Bad Request.


Affects: 3.0.2

Issue Links:

Referenced from: commits ac1d2d9, fa3e9bd

1 votes, 5 watchers

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions