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

Fix for #4607: native ObjectId handling failure #4612

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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