You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Andrew Zhang (JIRA)" <ji...@apache.org> on 2006/06/28 09:39:30 UTC

[jira] Updated: (HARMONY-683) [classlib][nio] java.nio.channels.DatagramChannel.write fails to write ByteBuffer whose position is not zero.

     [ http://issues.apache.org/jira/browse/HARMONY-683?page=all ]

Andrew Zhang updated HARMONY-683:
---------------------------------

    Attachment: nio.diff

Hello,

Would you please try my patch?

Thanks a lot!

Best regards,
Andrew

> [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
>  Attachments: nio.diff
>
> 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