Skip to content

Commit

Permalink
simplify checking empty json
Browse files Browse the repository at this point in the history
  • Loading branch information
JooHyukKim committed Apr 15, 2023
1 parent 46a2ae9 commit 5c7f131
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ public Object deserializeFromObject(JsonParser p, DeserializationContext ctxt) t
*/
return bean;
}

final Object bean = _valueInstantiator.createUsingDefault(ctxt);
// [databind#631]: Assign current value, to be accessible by custom deserializers
p.setCurrentValue(bean);
Expand All @@ -374,12 +375,8 @@ public Object deserializeFromObject(JsonParser p, DeserializationContext ctxt) t
}
}
// [databind#3838]: Uniform handling of missing objectId
if (_objectIdReader != null) {
// check if there are any properties present in the JSON object
if (!p.hasCurrentToken() || p.getCurrentToken() == JsonToken.END_OBJECT) {
// throw an error here since there are no properties in the JSON object
ctxt.reportUnresolvedObjectId(_objectIdReader, bean);
}
if (_objectIdReader != null && p.getCurrentToken() == JsonToken.END_OBJECT) {
ctxt.reportUnresolvedObjectId(_objectIdReader, bean);
}
if (_injectables != null) {
injectValues(ctxt, bean);
Expand Down

0 comments on commit 5c7f131

Please sign in to comment.