-
-
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
Can't serialize ByteArrayOutputStream
value when using jackson 2.13.0
#3493
Comments
I am surprised that one could try to serialize What result would you expect? And what would be the use case? |
ByteArrayOutputStream
value when using jackson 2.13.0
ByteArrayOutputStream is used to serialize a photo object , it works well using jackson 2.12.2 |
@JavaRukawa I don't understand. How could |
So. I do not see why or how
to avoid exception and get I will close this since I do not see anything to change at this point. |
@cowtowncoder FYI this is a regression caused by #3117 where JDK classes could previously be serialized as beans using private fields previously (confirmed with 2.11) with private visibility enabled it would serialize and deserialize fine, base64 encoding the
in 2.13 the visibility config override is ignored for
this means it is no longer possible to serialize JDK classes as beans based on private fields. given that java is becoming stricter about field access, and this was always possibly a bit dodgy, i don't have strong opinions on whether an opt-out for this is worth enabling. the right thing for OP (and me) is probably custom serialization for BAOS based around |
Thank you @ahgittin -- this makes sense. I will need to update release notes for 2.13 to say something about this. I'll have to think about it a bit tho... I was about to say that this is completely unsupported behavior, given there is no API for accessing content. Except that, well, there is However: I do not think it should produce serialization it used to -- it should, in my opinion, produce simple Base64-encoded value. I will file a new issue and can consider how to proceed. |
One more note: it is still possible to explicitly define
would allow using the old behavior. Only the default settings have been changed wrt JDK types; it is still possible to override them. |
Filed #3522 for considering re-introducing serializability, but now with proper Binary value, not POJO. |
It didn't help
Error:
|
@stamanker As comments above and especially, #3493 (comment), this issue is closed and perhaps the new opened issue #3522 can help? Also, just so you know, we need reports in plain Jackson to work with, meaning we need
and so on... whereas your provided stacktrace is in Spring |
@stamanker You are talking about serializing |
@cowtowncoder it's the same issue - it was working before.
|
@stamanker Ah. Yes, it is similar issue, but not same (from maintainer's POV) as it affects a different JDK class. Change itself may be due to similar underlying change (to prevent handling of JDK types as POJOs for security reasons) or might be something different. It is possible to report this as breakage to fix if anyone cares about it: if so, that can be discussed in the new issue. From conceptual perspective this type differs so I'd probably not be inclined to support serializability -- even if it happened to be possible earlier (by virtue of default handling considering type just any old POJO). |
when i write like this code, it goes wrong using jackson 2.13.0, but it works well using jackson 2.12.2
the error info:
The text was updated successfully, but these errors were encountered: