-
Notifications
You must be signed in to change notification settings - Fork 97
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
Deserialization of a nested inherited type with an unknown json object fails with a NullPointerException #589
Comments
Let me take a look... |
The first observation that struck me is that Yasson version 1.1.1 is nowhere to be found in public Maven repositories... If we look at https://mvnrepository.com/artifact/org.eclipse/yasson , we can versions 1.0.1 (Nov 2017), 1.0.10 (Nov 2021) and 1.0.11 (Jan 2022) there. Perhaps, you are using one of those? |
Big sry, my bad - it is of course version 3.0.1 (which is part of Wildfly 27). I updated my opening post. |
Oh, ok, I see. After some experiments, I managed to reproduce the error on 3.x code branch. It seems as the root cause of this is use of annotations (to specify the exact mapping of JSON-to-Java objects); the use of annotations cause Yasson to rely on the Let me try to implement them to see whether this will resolve the issue. If it does, then obviously you would have to wait for the next Yasson version - or even wait until Wildfly developers or maintainers choose to adopt it. OR grab it manually and add to Wildfly server libraries. The only workaround would be to set the |
Pretty sure this is the same issue. The problem is that JsonStructureToParserAdapter peek object without skipping to the next property. Thank you, D. P.S. the version is 3.0.2 |
@redmitry , will look into this on Monday. Seems similar indeed (I have noticed that JsonStructureToParserAdapter's |
Well, after studying and debuggin the Yasson code over the weekend, I must say the last issue is not an easy one to resolve... Apparently, (thinking about a workaround for this that would not break other things - few things already tried did break other tests...) |
@redmitry , thank you for bringing up a rather peculiar deserialization issue, and putting together a very useful test case! That issue is resolved now by amending the original code patch - it turns out, the root cause of the ORIGINAL bug described here was two-fold, and now both places are hopefully patched, and JSON deserialization is no longer "leaky". |
Describe the bug
Deserialization of an inherited type structure fails with a NullPointerException if the structure itself is nested and the structure contains an unknown object which should be skipped.
To Reproduce
Very basic model:
JSON representation containing an unknown object in the nested object.
If you try to deserialize the given JSON in the given model with
JsonbBuilder.create().fromJson(json, Outer.class);
this exception is thrownExpected behavior
The unmapped object should be skipped, no error should occur.
System information:
The text was updated successfully, but these errors were encountered: