harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Zhang (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-701) [classlib][nio] java.nio.channels.DatagramChannel.send(ByteBuffer, SocketAddress) sends data incorrectly if the position of ByteBuffer is not zero.
Date Thu, 29 Jun 2006 02:02:29 GMT
[classlib][nio] java.nio.channels.DatagramChannel.send(ByteBuffer, SocketAddress) sends data
incorrectly if the position of ByteBuffer is not zero.
---------------------------------------------------------------------------------------------------------------------------------------------------

         Key: HARMONY-701
         URL: http://issues.apache.org/jira/browse/HARMONY-701
     Project: Harmony
        Type: Bug

  Components: Classlib  
    Reporter: Andrew Zhang


java.nio.channels.DatagramChannel.send(ByteBuffer, SocketAddress) sends data incorrectly if
the position of ByteBuffer is not zero.

Following test case reproduces the bug. 

I'll upload a patch soon. Thanks! 

Test case:

    public void test_send_LBuffer_LSocketAddress_PositionNotZero()  throws Exception {
        int CAPACITY_NORMAL = 256;
        int postion = 16;
        DatagramChannel dc = DatagramChannel.open();
        SocketAddress addr = new InetSocketAddress("127.0.0.1", 50000);
        byte[] sourceArray = new byte[CAPACITY_NORMAL];
        // send ByteBuffer whose position is not zero
        ByteBuffer sourceBuf = ByteBuffer.wrap(sourceArray);
        sourceBuf.position(postion);
        assertEquals(CAPACITY_NORMAL - postion, dc.send(sourceBuf, addr));
    }

Test result:
RI 5.0 passes the test while Harmony fails. 

Best regards,
Andrew

-- 
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


Mime
View raw message