gora-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GORA-467) Flushing DataOutputStream before calling toByteArray on the underlying ByteArrayOutputStream
Date Thu, 04 Feb 2016 07:31:40 GMT

    [ https://issues.apache.org/jira/browse/GORA-467?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15131871#comment-15131871
] 

ASF GitHub Bot commented on GORA-467:
-------------------------------------

GitHub user emopers opened a pull request:

    https://github.com/apache/gora/pull/55

    GORA-467 Flushing DataOutputStream before calling toByteArray on the underlying ByteArrayOutputStreamFlushing
DataOutputStream before calling toByteArray on the underlying ByteArrayOutputStream

    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 [here](http://stackoverflow.com/questions/2984538/how-to-use-bytearrayoutputstream-and-dataoutputstream-simultaneously-java).
    This pull request add a flush method before toByteArray. I have also added a [Jira Issue](https://issues.apache.org/jira/browse/GORA-467).

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/emopers/gora baos_56

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/gora/pull/55.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #55
    
----
commit 4858c3b3073e664ca79c459393d39b6997549103
Author: emopers <emopers@gmail.com>
Date:   2016-02-04T07:20:31Z

    Fixing Usage of DataOutputStream

----


> 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
>
> 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)

Mime
View raw message