-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Support suppressed
property when deserializing Throwable
#3177
Comments
Ah. Yes, your reading of code and history is spot on. Jackson JDK baseline for building has been JDK 8 for a bit, but 2.12 is still officially JDK7 compliant for runtime. So, PR would be welcome, and I can help with it. I think this would be a great improvement. |
Supporting the suppressed property when deserializing Throwable
Hi @cowtowncoder I would be happy if you can give me feedback on the PR. The implementation is finished, and all tests are passing. |
Thanks! Will do -- will be out for a couple of days, will review once I get back! |
Addressing review comment. Small refactoring in order to reduce code duplication.
suppressed
property when deserializing Throwable
suppressed
property when deserializing Throwable
Hi,
when using Jackson 2.12.x in my project to serialize / deserialize instances of
Throwable
, I noticed that the serialized JSON output contains thesuppressed
property. This property is also successfully filled in JSON if the originalThrowable
has suppressed exceptions. However, when deserializing the JSON back again to a clonedThrowable
then this property is getting ignored, i.e. the cloned instance has an empty array of suppressed exceptions.When debugging this issue, I think I narrowed it down to BeanDeserializerFactory.buildThrowableDeserializer(...) where the
suppressed
property is added to the ignorable properties.Based on the comment, I guess this ignoring of the
suppressed
property has historic reasons because it was only introduced in JDK 7, and only sincejackson-databind
2.7 the Minimum JDK version is 1.7.Given that the Minimum JDK version is even 1.8 since
jackson-databind
2.12, what is your opinion on introducing deserialization support for thesuppressed
property? If you agree that this support should be introduced, I would give it a try to introduce it inBeanDeserializerFactory.buildThrowableDeserializer(...)
and then send you a pull request. Most likely, I would implement it in a style similar to how thecause
property ofThrowable
gets deserialized, i.e. I would add a manually constructedSettableBeanProperty
that is usingThrowable.addSuppressed(...)
for adding the suppressed exceptions to theThrowable
instance.The text was updated successfully, but these errors were encountered: