[JBoss JIRA] Commented: (NETTY-228) Method "ChannelBuffers.wrappedBuffer(ByteBuffer buffer)" does not always honor ByteOrder
Ben Schulz (JIRA)
jira-events at lists.jboss.org
Fri Sep 25 02:57:49 EDT 2009
[ https://jira.jboss.org/jira/browse/NETTY-228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12487360#action_12487360 ]
Ben Schulz commented on NETTY-228:
----------------------------------
I was just about to file a new issue, I'll just use the snapshot for now. One thing though: A read-only buffer can change its endianess, making the JavaDoc for wrappedBuffer(ByteBuffer) misleading!
With kind regards
Ben
> Method "ChannelBuffers.wrappedBuffer(ByteBuffer buffer)" does not always honor ByteOrder
> ----------------------------------------------------------------------------------------
>
> Key: NETTY-228
> URL: https://jira.jboss.org/jira/browse/NETTY-228
> Project: Netty
> Issue Type: Bug
> Components: Buffer
> Affects Versions: 3.1.3.GA
> Reporter: xjn xjn
> Assignee: Trustin Lee
> Fix For: 3.1.4.GA
>
>
> This results sonetimes in wrong buffer ByteOrder on using NioDatagramChannelFactory with "bufferFactory" set to LITTLE_ENDIAN Factories
> ChannelBuffers Rev 1685 Line 296
> 296 return wrappedBuffer(buffer.array(), buffer.arrayOffset(),buffer.remaining());
> should be changed to
> 296 return wrappedBuffer(buffer.order(), buffer.array(), buffer.arrayOffset(),buffer.remaining());
> public static ChannelBuffer wrappedBuffer(ByteBuffer buffer) {
> 292 if (!buffer.hasRemaining()) {
> 293 return EMPTY_BUFFER;
> 294 }
> 295 if (!buffer.isReadOnly() && buffer.hasArray()) {
> 296 return wrappedBuffer(buffer.array(), buffer.arrayOffset(),buffer.remaining());
> 297 } else {
> 298 return new ByteBufferBackedChannelBuffer(buffer);
> 299 }
> 300 }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the netty-dev
mailing list