-
-
Notifications
You must be signed in to change notification settings - Fork 84
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
Error when trying to deserialize BSON into a EXISTING_PROPERTY polymorphic class #67
Comments
This is interesting. I'm not sure if this is an issue with bson4jackson or Jackson maybe. @cowtowncoder What do you think? |
|
If you don't register BsonModule then you can't serialize the UUID field.
Can you elaborate? |
Looking at the stack trace:
this is due to Most likely |
IRT my comment about reflection field ordering, I was just trying to provide a hint to help narrow down the potential bug. I was able to reproduce the error on JDK 8, but there was a case where I was only seeing the error happen on JDK 7. After renaming the |
@cowtowncoder I see. Thanks for the detailed explanation! What do you suggest? Letting |
@michel-kraemer In this case it all comes from the need to copy tokens from BSON-backed parser, write in Anyway, so Now: on solution: one possibility would be to make Which brings me to one relevant 2.8 addition: method |
Ok: implemented these FasterXML/jackson-databind#1361 so that |
@cowtowncoder Thanks Tatu, for the help and for fixing this so quickly. I tested the code from @jonpeterson with the current Jackson snapshot, but the problem persists. I then wanted to debug bson4jackson and tried to write a unit test to reproduce the error, but everything worked correctly. I wasn't able to reproduce the error in a unit test written in Java. @jonpeterson Here's my unit test: Can you please check if this code does what you intent? If yes, I suppose it must have something to do with the way Groovy generates classes. I used
|
Add |
OK. I'm now able to reproduce it in my unit test. Thanks for the hint. I think I'm able to fix it quite easily. I'll try to make a commit tonight. |
Hello, I think we have encountered the same bug in Jongo : bguerout/jongo#257 and bguerout/jongo#288 |
Thanks, @bguerout! This was exactly what I was looking for. I implemented the solution for this issue in a similar same way. @jonpeterson the issue should be solved in master. It will only work correctly with Jackson 2.7.0 or higher |
I just uploaded a new snapshot including the fix: |
@michel-kraemer Would it be possible to release official 2.8.0, with Jackson 2.8(.6?) dependency? |
I just release bson4jackson 2.8.0. Sorry that it took me so long. Please note that version 2.9.0 will also be released later today or tomorrow. |
I ran into an problem when trying to deserialize BSON into a polymorphic class that uses
JsonTypeInfo.As.EXISTING_PROPERTY
.Groovy script:
Throws the stacktrace:
Hints:
JsonTypeInfo.As.PROPERTY
the issue goes away.BsonModule
the issue goes away.The text was updated successfully, but these errors were encountered: