-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Get NPE on deserializing values with recursive @JsonIgnoreProperties
#1755
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
Comments
I had to rollback to 2.7.9. It seems this bug appeared since 2.8.0, |
I would need a full reproduction here: member in question is the value deserializer, which should not be null. But perhaps there is a custom deserializer that does not properly resolve value deserializer. Alternative some features like Object Id handling ( Other than this I do not know of any existing problems that would manifest this way. |
Can not reproduce. May be reopened with a reproduction. |
@cowtowncoder I can also confirm this bug, exact same scenario as SO thread linked above. Specifically, This should be reopened. Minimal test case:
Input JSON:
Exception:
I can also confirm 2.7.9 works so this is a regression. |
@cen1 Thank you for including reproduction. But I think it is missing couple of types ( |
Updated previus post with full test case. Commenting out |
@cen1 Thanks! We'll see... it is problematic, being recursive self-reference, so may be simple, or might be next to impossible to tackle. Hope it's former :) |
I am able to reproduce this. NPE itself is due to recursive definition that somehow either prevents contextualization, or leaves non-contextual instance to be used ( |
Oddly enough, commenting out |
Yes, this is how I actually encountered the problem, after adding another list in my project. This may or may not be connected to #1575 (which I also encountered in v2.8.10 but on a recursive non-list property). |
@cen1 Thank you for pointing out #1575, I had a feeling I had worked on similar issue somewhat recently. |
Experiencing a similar error:
This error can be reproduced by checking out: https://github.com/statisticsnorway/raml-to-jsonschema.git and set jackson.version=2.9.7 and run test case |
@oranheim Could you please file a new issue as it's not necessarily same problem. I can have a look with reproduction, but things get confusing if it's actually caused by different underlying problem (which seems possible reading descriptions). |
@cowtowncoder It turned out to be a serialization issue on our side. So it was not a bug. Please disregard my error report :) |
Was the bug actually solved or is this wrongly closed again? |
I though it was fixed, isn't it? Issue opened for like 2 years lmao??? |
I think confusion here is that OP's problem not resolved; but someone who thought they had same issue found out it isn't. So I think this should not yet be closed. We do have failing test, |
@cowtowncoder we appreciate all your work and we know that is not easy. But this particular feature is a real problem for me. Is there any notice about that?. "(self-nesting of the same class) " is used for a tree a organization design, by example, base of the rest of data, and version 2.7 denies us to work with all new features. Nothing more to aport, same problem deserializing self-nesting of the same class |
I don't think there's any feature here, but a bug. If someone has time to figure it out, that'd be great, but at this point there are dozens of other problems to work on so I doubt I will have time to look into this at all on short or even medium term. There is a failing unit test ( |
Still present, i have the same problem, recursive object with @JsonIgnoreProperties and the problem appear. Methode : line 272 : if (valueDes.getObjectIdReader() != null) { |
@JsonIgnoreProperties
Hello, I just had the same problem (NPE at that same line 272 in
Otherwise there are bits missing in the serializers leading to the NPE while reading the JSON. |
Ggs maybe open a MR? |
I think code referenced would be in custom deserializer, and not in jackson-databind. It is true that the correct way to initialize, orchestrate use of deserializers to delegate to can be... tricky. |
Any update on this? |
No updates; no time to actively work on this. |
In case this might help anybody working on this, sharing this here. I took a stab at this issue (sample in my personal PR) and here are some of my findings+guesses.
|
Old problem but it remains me this working code:
allowSetters = true was the key here
|
For what it's worth, |
@JooHyukKim Some reference somewhere does not get updated that much seems certain. I also spent some time trying to figure this out in the past, without managing to get there. |
I'm using spring-mvc for a
restful
service. By adding the dependency, my rest controllers automaticallygenerate json
from myresponse entities
.Dependency
Objects
Problem
Problems come in
special cases
. For example, I want to add anactivity
to anuser
. The following user-jsonworks
good,Jackson converts it without error.
But if I add an activity with sub activities, it crashes!
Indeed, jackson
can't deserialize
this json and I don't understand why. I get the following error.. Any idea?The text was updated successfully, but these errors were encountered: