[
https://issues.apache.org/jira/browse/DIRMINA-369?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Emmanuel Lecharny closed DIRMINA-369.
-------------------------------------
> 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
> Assignee: 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.