commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Gregory (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DBCP-540) Close ObjectOutputStream before calling toByteArray on underlying ByteArrayOutputStream #28
Date Sat, 30 Mar 2019 01:23:00 GMT

     [ https://issues.apache.org/jira/browse/DBCP-540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Gary Gregory updated DBCP-540:
------------------------------
    Description: 
Close ObjectOutputStream before calling toByteArray on underlying ByteArrayOutputStream #28
{quote}
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.
This pull request flips the order of close and toytBeArray methods.
{quote}

  was:Close ObjectOutputStream before calling toByteArray on underlying ByteArrayOutputStream
#28


> Close ObjectOutputStream before calling toByteArray on underlying ByteArrayOutputStream
#28
> -------------------------------------------------------------------------------------------
>
>                 Key: DBCP-540
>                 URL: https://issues.apache.org/jira/browse/DBCP-540
>             Project: Commons DBCP
>          Issue Type: Improvement
>            Reporter: Gary Gregory
>            Priority: Trivial
>
> Close ObjectOutputStream before calling toByteArray on underlying ByteArrayOutputStream
#28
> {quote}
> 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.
> This pull request flips the order of close and toytBeArray methods.
> {quote}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message