[GitHub] emopers opened a new pull request #28: Close ObjectOutputStream before calling toByteArray on underlying ByteArrayOutputStream

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] emopers opened a new pull request #28: Close ObjectOutputStream before calling toByteArray on underlying ByteArrayOutputStream

GitBox
emopers opened a new pull request #28: Close ObjectOutputStream before calling toByteArray on underlying ByteArrayOutputStream
URL: https://github.com/apache/commons-dbcp/pull/28
 
 
   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 this case it is not strictly necessary because
   `writeObject` method is invoked right before `toByteArray`, and `writeObject`
   internally calls `flush`/`drain`. However, it is good practice to call
   `flush`/`close` explicitly as mentioned, for example, [here](http://stackoverflow.com/questions/2984538/how-to-use-bytearrayoutputstream-and-dataoutputstream-simultaneously-java).
   This pull request flips the order of `close` and `toytBeArray` methods.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[hidden email]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]