-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
2.19Issues planned at 2.19 or laterIssues planned at 2.19 or later
Description
Is your feature request related to a problem? Please describe.
When using JsonCreator on a factory (static) method, we have the possibility of returning null (because for example all the arguments are empty). However during deserialization an exception is thrown, java.lang.NullPointerException: JSON Creator returned nul.
I think it would make sense to allow deserialization to null
Describe the solution you'd like
Improve the code robustness in the BeanEntityDeserializer to allow Deserialization to null if a static JsonCreator explicitly allows it.
Usage example
@JsonCreator
public static Localized3 of(@JsonProperty("en") String en, @JsonProperty("de") String de, @JsonProperty("fr") String fr) {
if (en == null && de == null && fr == null) {
return null;
}
return new Localized3(en, de, fr);
}
should be allowed for Deserialization and { en: null, de: null, fr: null } should deserialize to null
Additional context
No response
pistolpat
Metadata
Metadata
Assignees
Labels
2.19Issues planned at 2.19 or laterIssues planned at 2.19 or later