Skip to content

TypeMismatchException instead of IllegalArgumentException: argument type mismatch for wrong RequestBody [SPR-7263] #11922

@spring-projects-issues

Description

@spring-projects-issues

Gerrit Brehmer opened SPR-7263 and commented

If a controller method is called with a wrong (but for message converter known type) @RequestBody message, an java internal reflection exception will be raised: java.lang.IllegalArgumentException: argument type mismatch.

It would be nice, if a Spring-TypeMismatchException exception could be raised instead (so a type check is needed). This exception is already mapped to a 400 Bad Request. With IllegalArgumentException the cause of the exception is not exactly enough.


Affects: 3.0.2

Attachments:

Referenced from: commits 65885d1, 723f94f

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