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-683) [classlib][nio] java.nio.channels.DatagramChannel.write fails to write ByteBuffer whose position is not zero.
Date Wed, 28 Jun 2006 05:29:30 GMT
[classlib][nio] java.nio.channels.DatagramChannel.write fails to write ByteBuffer whose position
is not zero.
-------------------------------------------------------------------------------------------------------------

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

  Components: Classlib  
    Reporter: Andrew Zhang


java.nio.channels.DatagramChannel.write(ByteBuffer),write(ByteBuffer,int,int) fails to write
ByteBuffer whose position is not zero.

Following test case reproduces the bug. 

I'll upload a patch soon. Thanks!

Test Case:
        public void test_write_buffer_positioned() 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];        
        dc.connect(addr);
        // write
        ByteBuffer sourceBuf = ByteBuffer.wrap(sourceArray);
        sourceBuf.position(postion);
        assertEquals(CAPACITY_NORMAL - postion, dc.write(sourceBuf));
    }

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

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