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-754) [classlib][nio] java.nio.channels.DatagramChannel.read(ByteBuffer[]) and read(ByteBuffer[],int,int) fail to return even some data are available.
Date Wed, 05 Jul 2006 03:26:29 GMT
[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


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


Mime
View raw message