You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2010/03/05 01:39:27 UTC

[jira] Commented: (IO-214) Inconsistent synchronization of fields

    [ https://issues.apache.org/jira/browse/IO-214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12841627#action_12841627 ] 

Sebb commented on IO-214:
-------------------------

The currentBuffer and currentBuffer index fields are updated by the private method needNewBuffer(int); however this method is called by the constructor without the benefit of synchronization.

So if an instance is created in one thread and passed to another existing thread, the fields might not be published correctly.

> Inconsistent synchronization of fields
> --------------------------------------
>
>                 Key: IO-214
>                 URL: https://issues.apache.org/jira/browse/IO-214
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Streams/Writers
>            Reporter: Sebb
>         Attachments: IO-214-Counting-Stream-Sync.patch
>
>
> The field ByteArrayOutputStream.count is always accessed in a synchronised block, apart from when the user calls toBufferedInputStream().
> This seems wrong.
> Similarly for the count field in CountingOutputStream.beforeWrite(int n)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.