Skip to content

Commit

Permalink
Fix for #4607: native ObjectId handling failure
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jul 4, 2024
1 parent ba28fe3 commit 6784386
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions release-notes/CREDITS-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -1779,3 +1779,8 @@ Peter Levart (plevart@github)
* Reported, contributed fix for #4575: StdDelegatingSerializer does not consider
a Converter that may return null for a non-null input
(2.17.2)

Susan Witts (susanw1@github)
* Reported #4607: `MismatchedInput`: No Object Id found for an instance of X to
assign to property '@id'
(2.17.2)
3 changes: 3 additions & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ Project: jackson-databind
(reported by @dmelisso)
#4595: No way to explicitly disable wrapping in custom annotation processor
(reported by @SimonCockx)
#4607: `MismatchedInput`: No Object Id found for an instance of X to
assign to property '@id'
(reported by Susan W)
#4610: `DeserializationFeature.FAIL_ON_UNRESOLVED_OBJECT_IDS` does not work when
used with Polymorphic type handling
(fix by Joo-Hyuk K)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,15 +363,18 @@ public Object deserializeFromObject(JsonParser p, DeserializationContext ctxt) t
final Object bean = _valueInstantiator.createUsingDefault(ctxt);
// [databind#631]: Assign current value, to be accessible by custom deserializers
p.assignCurrentValue(bean);

// First: do we have native Object Ids (like YAML)?
if (p.canReadObjectId()) {
Object id = p.getObjectId();
if (id != null) {
_handleTypedObjectId(p, ctxt, bean, id);
}
}
// [databind#3838]: since 2.16 Uniform handling of missing objectId
// only for the specific "empty JSON Object" case
if (_objectIdReader != null && p.hasTokenId(JsonTokenId.ID_END_OBJECT)) {
// only for the specific "empty JSON Object" case (and only for non-Native
// Object Ids, see [databind#4607]
else if (_objectIdReader != null && p.hasTokenId(JsonTokenId.ID_END_OBJECT)) {
// [databind#4610]: check if we are to skip failure
if (ctxt.isEnabled(DeserializationFeature.FAIL_ON_UNRESOLVED_OBJECT_IDS)) {
ctxt.reportUnresolvedObjectId(_objectIdReader, bean);
Expand Down

0 comments on commit 6784386

Please sign in to comment.