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

Niall Pemberton updated IO-214:
-------------------------------

    Attachment: IO-214-Counting-Stream-Sync.patch

The *private* toBufferedInputStream() method that uses the count field is only 
ever called by the public *static* toBufferedInputStream() method and is a 
local variable only ever accessed within that static method so I can't see how 
it would ever need to be synchronized.

Looks like the counting OutputStream issue was introduced recently in IO-211 - 
and the same applies to counting InputStream

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

Reply via email to