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

Added deserializeWithObjectId to SuperSonicBeanDeserializer. #58

Closed

Conversation

Janekdererste
Copy link

This enables the deserializing cyclic object graphs which were created with @JsonIdentityInfo

This enables the deserializing cyclic object graphs which were created with @JsonIdentityInfo
@Janekdererste
Copy link
Author

This fixes #54

@Janekdererste
Copy link
Author

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?

@Janekdererste
Copy link
Author

And I think some of your unit tests are broken. They also failed on my machine right after I checked out the project.

Copy link

@headw01 headw01 left a 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
@Janekdererste
Copy link
Author

Sorry for the late response, since I was on vacation. I moved the test for object Ids as recommended.

@cowtowncoder
Copy link
Member

@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.

@Janekdererste
Copy link
Author

Janekdererste commented Aug 30, 2018

If you have any questions while trying to understand the issue, feel free to ask. I've thought a little bit about this now :-)

@cowtowncoder
Copy link
Member

@Janekdererste Trying to reproduce the issue with 2.9, but for some reason tests actually pass for me.
So it may be that problem only occurs for master, which is for 3.0.0. That would also explain test failures as 3.x codebase has changed a lot and sometimes changes in databind are not fully reflected for extension modules (that is, downstream changes sometimes lag).

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.

@cowtowncoder
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants