Skip to content
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 serializing ByteArrayOutputStream as "simple" Binary value #3522

Open
cowtowncoder opened this issue Jun 20, 2022 · 0 comments
Open
Labels
3.x Issues to be only tackled for Jackson 3.x, not 2.x

Comments

@cowtowncoder
Copy link
Member

(note: follow-up to #3493)

Before Jackson 2.12, apparently it was possible to serialize ByteArrayOutputStream values as a POJO -- if (and only if) auto-detection of all visibility levels (including private) was enabled. If so, a POJO with buf and length fields were produced.
With 2.13 the default visibility settings for JDK types were changed to only detect public accessors; this also prevents custom default visibility from being applied. As a result, ByteArrayOutputStream values are no longer serializable.

But it might make sense to make it serializable again. However, the representation as POJO does not make sense: if serialization is to be used, it should:

  1. Use public ByteArrayOutStream.toByteArray() to access content
  2. Serialize contents as a Binary value: for JSON backend this means Base64-encoded String; for other backends whatever their representation of Binary values is

I realize that this behavior is different from the earlier one so it is an open question if this should be deferred until Jackson 3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Issues to be only tackled for Jackson 3.x, not 2.x
Projects
None yet
Development

No branches or pull requests

1 participant