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

MessageNotReadableAdviceTrait not working for Spring v5.2.4.RELEASE #455

Closed
bpicode opened this issue Mar 4, 2020 · 2 comments
Closed
Labels

Comments

@bpicode
Copy link

bpicode commented Mar 4, 2020

Observed with Spring v5.2.4. Whenever a request body cannot be deserialized by failing with a JsonMappingException, the MessageNotReadableAdviceTrait does not get invoked.

Description

I noticed this in a kotlin project, where a MissingKotlinParameterException was thrown. This exception should, in general, map to a 400 Bad Request with a problem description.

Expected Behavior

A 400 Bad Request in the aforementioned case.

Actual Behavior

In my case, a 500 Server Error was returned (generic fallback).

Possible Fix

I noticed that MessageNotReadableAdviceTrait relies on a HttpMessageNotReadableException being thrown. With spring-projects/spring-framework@b889700 Spring throws a HttpMessageConversionException instead. One might fix this problem here by introducing another AdviceTrait handling such exceptions. Not sure however, if one should reach out to spring team instead.

Steps to Reproduce

Maybe later, limited on time :(

Context

See above.

Your Environment

  • Version used: 0.25.2
@bpicode bpicode added the Bug label Mar 4, 2020
@whiskeysierra
Copy link
Collaborator

Related to spring-projects/spring-framework#24610

@whiskeysierra
Copy link
Collaborator

Corresponding issue in Spring has been fixed.

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

No branches or pull requests

2 participants