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/07/05 10:48:30 UTC

[jira] Updated: (HARMONY-754) [classlib][nio] java.nio.channels.DatagramChannel.read(ByteBuffer[]) and read(ByteBuffer[],int,int) fail to return even some data are available.

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

Andrew Zhang updated HARMONY-754:
---------------------------------

    Attachment: nio.diff

Hello,

Would you please try my patch?

Thanks!

Best regards,
Andrew

> [classlib][nio] java.nio.channels.DatagramChannel.read(ByteBuffer[]) and read(ByteBuffer[],int,int) fail to return even some data are available.
> ------------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: HARMONY-754
>          URL: http://issues.apache.org/jira/browse/HARMONY-754
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Andrew Zhang
>  Attachments: nio.diff
>
> java.nio.channels.DatagramChannel.read(ByteBuffer[]) and read(ByteBuffer[],int,int) fail to return even some data are available.
> Following test reproduces the problem:
>  public void test_read_$LByteBuffer() throws Exception {
>         int capcity = 64;
>         DatagramChannel channel1 = DatagramChannel.open();
>         DatagramChannel channel2 = DatagramChannel.open();
>         // make connection between channel1 and channel2
>         channel1.socket().bind(
>                 new InetSocketAddress(InetAddress.getLocalHost(), 0));
>         channel2.socket().bind(
>                 new InetSocketAddress(InetAddress.getLocalHost(), 0));
>         channel1.connect(channel2.socket().getLocalSocketAddress());
>         channel2.connect(channel1.socket().getLocalSocketAddress());
>         // channel2 writes some data to channel1
>         channel2.write(ByteBuffer.allocate(capcity));
>         ByteBuffer[] readBuf = new ByteBuffer[2];
>         readBuf[0] = ByteBuffer.allocateDirect(capcity);
>         readBuf[1] = ByteBuffer.allocateDirect(capcity);
>         channel1.configureBlocking(true);
>         // channel1 reads some data from channel2
>         // Harmony hangs at this line.
>         long ret = channel1.read(readBuf);
>         assertEquals(capcity, ret);
>     }
> RI passes the test while Harmony fails. 
> I'll upload a patch soon.
> Thanks!
> 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