-
Notifications
You must be signed in to change notification settings - Fork 15
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
Cannot round-trip If DefaultTyping.NON_FINAL is used #15
Comments
fsparv
pushed a commit
to fsparv/jsog-jackson
that referenced
this issue
Apr 30, 2017
At Jackson 2.7 the exception changes subtly, apparently getting further before experiencing an error (line 2 col 11 instead of line 2 col 3).
|
fsparv
pushed a commit
to fsparv/jsog-jackson
that referenced
this issue
Apr 30, 2017
Added a proposed fix to the pull request. Essentially upgrade to 2.5.4 and make JSOGRef a final class |
ping? |
Huh weird, I don't recall getting any notifications of these msgs - sorry. Merged. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue #5 explores serializing with JSOG without requiring annotations on the objects. A fabulous mixin-type workaround/solution was found. This is great for code cleanliness, but EVEN BETTER, it leads to the ability to JSOG serialize and deserialize 3rd party objects for which we have no hope of adding annotations. JSOG is absolutely required in such a case because 3rd party classes may well have circular references that lead to StackOverflowError.
The workaround however doesn't quite work in the generalized case due to a bug.
To handle any arbitrary class that a 3rd party might throw at you, you have to handle polymorphism. Jackson documentation shows 4 levels of default typing and all 4 levels cooperate well on serialization, but when the resulting JSON is deserialized here's what I've found:
I will be adding a pull request shortly with test demonstrating the problem.
This issue is based on the basic thesis that
should always succeed regardless of the settings, and with or without jsog. I am filing this here since It's demonstrated with JSOG, and removing JSOG mixin for Object.class prevents the exception on deserialize (but of course goes back to failing on serializing circular references, and duplicating objects in DAG's).
Note also that the structure doesn't have to actually BE polymorphic to set this off. I believe the issue is that jsog-jackson tries to interpose JSOGRef for objects, but there's no wrapper array with typing information for the JSOGRef, and so Jackson fails out, looking for the array that should pair the type designator, with the actual value.
Here's the associated stack trace for reference...
The text was updated successfully, but these errors were encountered: