-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
to-evaluateIssue that has been received but not yet evaluatedIssue that has been received but not yet evaluated
Description
Describe the bug
Varying behavior on DeserializationFeature .FAIL_ON_UNRESOLVED_OBJECT_IDS is observed when invoking readValue() using mapper.configure(jsonWithMissingId)and mapper.readerFor().with(jsonWithMissingId)
Version information
2.15 (default branch)
To Reproduce
I have included this in #3880
Using mapper.readerFor().with()
public void testUnresolvableWithFeatureSymmetry() throws Exception
{
// specifically configured to "not" fail
IdWrapper w = MAPPER.readerFor(IdWrapper.class)
.without(DeserializationFeature.FAIL_ON_UNRESOLVED_OBJECT_IDS)
.readValue(a2q("{'node':123}"));
assertNotNull(w);
assertNull(w.node);
// specifically configured to fail, but doesn't
IdWrapper w2 = MAPPER.readerFor(IdWrapper.class)
.with(DeserializationFeature.FAIL_ON_UNRESOLVED_OBJECT_IDS)
.readValue(a2q("{'node':123}"));
assertNotNull(w2);
assertNull(w2.node);
}Using mapper.configure()
public void testUnresolvableConfigureFeatureSymmetry() throws Exception
{
// specifically configured to "not" fail
IdWrapper w = MAPPER
.configure(DeserializationFeature.FAIL_ON_UNRESOLVED_OBJECT_IDS, false)
.readValue(a2q("{'node':123}"), IdWrapper.class);
assertNotNull(w);
assertNull(w.node);
// specifically configured to fail
try {
IdWrapper w2 = MAPPER
.configure(DeserializationFeature.FAIL_ON_UNRESOLVED_OBJECT_IDS, true)
.readValue(a2q("{'node':123}"), IdWrapper.class);
fail("should not pass");
} catch (UnresolvedForwardReference e) {
verifyException(e, "Unresolved forward reference", "Object id [123]");
}
}Expected behavior
Below code should fail with UnresolvedForwardReference
// specifically configured to fail, but doesn't
IdWrapper w2 = MAPPER.readerFor(IdWrapper.class)
.with(DeserializationFeature.FAIL_ON_UNRESOLVED_OBJECT_IDS)
.readValue(a2q("{'node':123}"));Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
to-evaluateIssue that has been received but not yet evaluatedIssue that has been received but not yet evaluated