You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2019/01/23 08:41:14 UTC

[GitHub] emopers opened a new pull request #400: Close/flush the `OutputStream` before calling `toByteArray()` on underlying `ByteArrayOutputStream`

emopers opened a new pull request #400: Close/flush the `OutputStream` before calling `toByteArray()` on underlying `ByteArrayOutputStream`
URL: https://github.com/apache/commons-lang/pull/400
 
 
   When an `OutputStream` instance wraps an underlying `ByteArrayOutputStream` instance,
   it is recommended to flush or close the `OutputStream` before invoking the underlying instances' `toByteArray()`. Although in some of these case it is not strictly necessary because the
   `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 adds a call to `close()` or `flush()` before calls to `toByteArray()`.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services