Skip to content

Conversation

@sdeleuze
Copy link
Contributor

@sdeleuze sdeleuze commented Apr 5, 2017

InvalidDefinitionException has been introduced in Jackson 2.9 to be
able to differentiate invalid data sent from the client (should still
generate a 4xx HTTP status code) from server side errors like beans with
no default constructor (should generate a 5xx HTTP status code).

Could you have a look and say me if you are ok @poutsma ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, Optionals should only be used as a return type, not a field value. So I would store this as a HttpStatus field with a potential null value. See http://blog.joda.org/2014/11/optional-in-java-se-8.html for reasons why.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense, fixed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should generally remain defensive against overuse of Optional. So agreed, let's avoid it as field type and only expose it for method signatures where it nicely aligns with typical use of the method.

InvalidDefinitionException has been introduced in Jackson 2.9 to be able to differentiate invalid data sent from the client (should still generate a 4xx HTTP status code) from server side errors like beans with no default constructor (should generate a 5xx HTTP status code). Issue: SPR-14925
@sdeleuze
Copy link
Contributor Author

sdeleuze commented Apr 5, 2017

Merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants