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 05:26:29 UTC

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

[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


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

Posted by "Andrew Zhang (JIRA)" <ji...@apache.org>.
     [ 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


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

Posted by "George Harley (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-754?page=all ]
     
George Harley resolved HARMONY-754:
-----------------------------------

    Resolution: Fixed

Hi Andrew, 

Patch committed in revision 419217. Please could you verify that it has all been applied as expected. 

Many thanks for this enhancement. 

Best regards, 
George


> [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
>     Assignee: George Harley
>  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


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

Posted by "George Harley (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-754?page=all ]

George Harley reassigned HARMONY-754:
-------------------------------------

    Assign To: George Harley

> [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
>     Assignee: George Harley
>  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


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

Posted by "Andrew Zhang (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-754?page=comments#action_12419378 ] 

Andrew Zhang commented on HARMONY-754:
--------------------------------------

Hello George,

The fix looks good. Many 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
>     Assignee: George Harley
>  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


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

Posted by "George Harley (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-754?page=all ]
     
George Harley closed HARMONY-754:
---------------------------------


Verified by 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
>     Assignee: George Harley
>  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