You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Trustin Lee (JIRA)" <ji...@apache.org> on 2007/04/13 14:35:15 UTC

[jira] Resolved: (DIRMINA-369) StreamIoHandler can flush garbled data.

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

Trustin Lee resolved DIRMINA-369.
---------------------------------

    Resolution: Fixed

> StreamIoHandler can flush garbled data.
> ---------------------------------------
>
>                 Key: DIRMINA-369
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-369
>             Project: MINA
>          Issue Type: Bug
>          Components: Handler
>    Affects Versions: 1.0.1, 1.0.2, 1.0.3, 1.1.0
>            Reporter: Trustin Lee
>         Assigned To: Trustin Lee
>             Fix For: 1.0.4, 1.1.1
>
>
> The OutputStream which StreamIoHandler provided doesn't perform defensive copy.  Some wrapper OutputStreams and Writers (e.g. BufferedOutputStream and BufferedWriter) reuse their internal byte array, and causes the byte buffer to be modified before it's actually written out to the channel.  There are two solutions:
> 1) Perform defensive copy in write(byte[], int, int): 
>     public void write( byte[] b, int off, int len ) throws IOException
>     {
>         write( ByteBuffer.wrap( (byte[]) b.clone(), off, len ) );
>     }
> 2) Wait for the WriteFuture for every operation.
> The former sounds better IMO.

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