[JBoss JIRA] Created: (NETTY-228) Method "ChannelBuffers.wrappedBuffer(ByteBuffer buffer)" does not always honor ByteOrder

xjn xjn (JIRA) jira-events at lists.jboss.org
Sat Sep 19 07:17:49 EDT 2009


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


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