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

Closing ObjectOutputStream before calling toByteArray on the underlying ByteArrayOutputStream #339

Merged
merged 1 commit into from
Jan 1, 2016

Conversation

emopers
Copy link
Contributor

@emopers emopers commented Dec 27, 2015

When an ObjectOutputStream instance wraps an underlying ByteArrayOutputStream instance,
it is recommended to flush or close the ObjectOutputStream before invoking the underlying instances's toByteArray().
Although in these cases this is not strictly necessary because the
writeObject method is invoked right before toByteArray, and writeObject
internally calls flush/drain. However, it is a good practice to call
flush/close explicitly as mentioned for example here.
This pull request flips the order of close and toytBeArray methods.
While there are seemingly many changes, they're all just copies of
the same change. Please let me know if you want me to extract the
common code into one helper method.

jodastephen added a commit that referenced this pull request Jan 1, 2016
Closing ObjectOutputStream before calling toByteArray on the underlying ByteArrayOutputStream
@jodastephen jodastephen merged commit f415294 into JodaOrg:master Jan 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

2 participants