-
Notifications
You must be signed in to change notification settings - Fork 77
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
Added deserializeWithObjectId to SuperSonicBeanDeserializer. #58
Added deserializeWithObjectId to SuperSonicBeanDeserializer. #58
Conversation
This enables the deserializing cyclic object graphs which were created with @JsonIdentityInfo
This fixes #54 |
Please have a look at the unit tests. I didn't know how to force the usage of SuperSonicBeanDeserializer so I just created a Bean with many properties. Maybe there is a more elegant way to do this? |
And I think some of your unit tests are broken. They also failed on my machine right after I checked out the project. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overriding the deserializeWithObjectId
of BeanDeserializerBase
still leaves the SuperSonicBeanDeserializer.deserializeFromObject
exposed with the bug.
I think that you should just put this code:
/* See BeanDeserializer.deserializeFromObject. [databind#622]
* ...Allow Object Id References to come in as JSON Objects as well...
*/
if ((_objectIdReader != null) && _objectIdReader.maySerializeAsObject()) {
if (p.hasTokenId(JsonTokenId.ID_FIELD_NAME)
&& _objectIdReader.isValidReferencePropertyName(p.getCurrentName(), p)) {
return deserializeFromObjectId(p, ctxt);
}
}
to the top of the SuperSonicBeanDeserializer.deserializeFromObject
method itself.
SuperSonicBeanDeserializer.deserializeFromObject
Sorry for the late response, since I was on vacation. I moved the test for object Ids as recommended. |
@Janekdererste Thank you for contributing this! I will see if I can merge that in 2.9 (assuming this is problem with 2.x too, not just 3.0), and will also want to verify I understand the issue. |
If you have any questions while trying to understand the issue, feel free to ask. I've thought a little bit about this now :-) |
@Janekdererste Trying to reproduce the issue with 2.9, but for some reason tests actually pass for me. However... #54 suggests 2.9.x does have issues. So the first thing is to make sure there is reproduction. I'll see if I can port databind test 622 over and go from there. |
Was able to reproduce with a test from databind; manually merged fix as suggested (thank you again for your work). Will be include din 2.9.7 release. |
This enables the deserializing cyclic object graphs which were created with @JsonIdentityInfo