You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gora.apache.org by "Lewis John McGibbney (JIRA)" <ji...@apache.org> on 2016/02/05 07:39:40 UTC
[jira] [Resolved] (GORA-467) Flushing DataOutputStream before
calling toByteArray on the underlying ByteArrayOutputStream
[ https://issues.apache.org/jira/browse/GORA-467?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lewis John McGibbney resolved GORA-467.
---------------------------------------
Resolution: Fixed
Thank you [~emopers]
> Flushing DataOutputStream before calling toByteArray on the underlying ByteArrayOutputStream
> --------------------------------------------------------------------------------------------
>
> Key: GORA-467
> URL: https://issues.apache.org/jira/browse/GORA-467
> Project: Apache Gora
> Issue Type: Bug
> Components: gora-core
> Reporter: emopers
> Priority: Minor
> Fix For: 0.7
>
>
> In ./gora-core/src/test/java/org/apache/gora/util/TestWritableUtils.java
> {code}
> ByteArrayOutputStream bos = new ByteArrayOutputStream();
> DataOutput out = new DataOutputStream(bos);
> WritableUtils.writeProperties(out, props);
>
> DataInput in = new DataInputStream(new ByteArrayInputStream(bos.toByteArray()));
> {code}
> When a DataOutputStream instance wraps an underlying ByteArrayOutputStream instance,
> it is recommended to flush or close the DataOutputStream before invoking the underlying instances's toByteArray(). Also, it is a good practice to call flush/close explicitly as mentioned for example at http://stackoverflow.com/questions/2984538/how-to-use-bytearrayoutputstream-and-dataoutputstream-simultaneously-java.
> The patch adds a flush method before calling toByteArray().
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)