[ http://issues.apache.org/jira/browse/DIRMINA-146?page=all ]
Niklas Therning resolved DIRMINA-146:
-------------------------------------
Resolution: Fixed
> ByteBuffer.wrap(byte[] n, int offset, int length) calls clear() on the
> wrapped NIO buffer
> -----------------------------------------------------------------------------------------
>
> Key: DIRMINA-146
> URL: http://issues.apache.org/jira/browse/DIRMINA-146
> Project: Directory MINA
> Type: Bug
> Versions: 0.9
> Reporter: Niklas Therning
> Assignee: Niklas Therning
> Fix For: 0.9.1
>
> clear() is called on the underlying NIO buffer wrapping the byte array. The
> consequence is that the position is set to 0 and the limit is set to capacity
> (the length of the wrapped array). Since this method should behave exactly as
> the NIO ByteBuffer equivalent the position should be set to offset and the
> limit should be set to offset+length.
> Whenever an existing NIO ByteBuffer is wrapped in a MINA ByteBuffer the NIO
> buffer is cleared. That may not always be desirable. I suggest that the call
> to clear() is removed from DefaultByteBuffer.init(). That would take care of
> the bug described above. If the user wishes to wrap an NIO buffer she would
> have to make sure it is cleared if that is desired.
> NOTE: This isn't a problem in MINA 0.8. clear() isn't called on the wrapped
> NIO buffer in DefaultByteBuffer.init(). Does anyone know why this was
> introduced in 0.9?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira