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/29 04:02:29 UTC

[jira] Created: (HARMONY-701) [classlib][nio] java.nio.channels.DatagramChannel.send(ByteBuffer, SocketAddress) sends data incorrectly if the position of ByteBuffer is not zero.

[classlib][nio] java.nio.channels.DatagramChannel.send(ByteBuffer, SocketAddress) sends data incorrectly if the position of ByteBuffer is not zero.
---------------------------------------------------------------------------------------------------------------------------------------------------

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

  Components: Classlib  
    Reporter: Andrew Zhang


java.nio.channels.DatagramChannel.send(ByteBuffer, SocketAddress) sends data incorrectly if the position of ByteBuffer is not zero.

Following test case reproduces the bug. 

I'll upload a patch soon. Thanks! 

Test case:

    public void test_send_LBuffer_LSocketAddress_PositionNotZero()  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];
        // send ByteBuffer whose position is not zero
        ByteBuffer sourceBuf = ByteBuffer.wrap(sourceArray);
        sourceBuf.position(postion);
        assertEquals(CAPACITY_NORMAL - postion, dc.send(sourceBuf, addr));
    }

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

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-701) [classlib][nio] java.nio.channels.DatagramChannel.send(ByteBuffer, SocketAddress) sends data incorrectly if the position of ByteBuffer is not zero.

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

    Resolution: Fixed

Thanks Andrew.

Patch applied to NIO module at repo revision r418741.

Please check that the patch was applied as you expected.


> [classlib][nio] java.nio.channels.DatagramChannel.send(ByteBuffer, SocketAddress) sends data incorrectly if the position of ByteBuffer is not zero.
> ---------------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: HARMONY-701
>          URL: http://issues.apache.org/jira/browse/HARMONY-701
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Andrew Zhang
>     Assignee: Tim Ellison
>  Attachments: nio.diff
>
> java.nio.channels.DatagramChannel.send(ByteBuffer, SocketAddress) sends data incorrectly if the position of ByteBuffer is not zero.
> Following test case reproduces the bug. 
> I'll upload a patch soon. Thanks! 
> Test case:
>     public void test_send_LBuffer_LSocketAddress_PositionNotZero()  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];
>         // send ByteBuffer whose position is not zero
>         ByteBuffer sourceBuf = ByteBuffer.wrap(sourceArray);
>         sourceBuf.position(postion);
>         assertEquals(CAPACITY_NORMAL - postion, dc.send(sourceBuf, addr));
>     }
> Test result:
> RI 5.0 passes the test while Harmony fails. 
> 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-701) [classlib][nio] java.nio.channels.DatagramChannel.send(ByteBuffer, SocketAddress) sends data incorrectly if the position of ByteBuffer is not zero.

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

Andrew Zhang commented on HARMONY-701:
--------------------------------------

Another bug of java.nio.channels.DatagramChannel.send(ByteBuffer, SocketAddress) :

This method doesn't set the right position of ByteBuffer sometimes.

Following test reproduces the bug. I'll fix these two bugs with one patch. 

Thanks!

Test case:

    public void test_send_LBuffer_LSocketAddress_PositonNotZero()
            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];
        // send ByteBuffer whose position is not zero
        ByteBuffer sourceBuf = ByteBuffer.wrap(sourceArray);
        sourceBuf.position(postion);
        int ret = dc.send(sourceBuf, addr);
        //assertEquals(CAPACITY_NORMAL - postion, ret);
        assertEquals(CAPACITY_NORMAL, sourceBuf.position());
    }

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

Best regards,
Andrew

> [classlib][nio] java.nio.channels.DatagramChannel.send(ByteBuffer, SocketAddress) sends data incorrectly if the position of ByteBuffer is not zero.
> ---------------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: HARMONY-701
>          URL: http://issues.apache.org/jira/browse/HARMONY-701
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Andrew Zhang

>
> java.nio.channels.DatagramChannel.send(ByteBuffer, SocketAddress) sends data incorrectly if the position of ByteBuffer is not zero.
> Following test case reproduces the bug. 
> I'll upload a patch soon. Thanks! 
> Test case:
>     public void test_send_LBuffer_LSocketAddress_PositionNotZero()  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];
>         // send ByteBuffer whose position is not zero
>         ByteBuffer sourceBuf = ByteBuffer.wrap(sourceArray);
>         sourceBuf.position(postion);
>         assertEquals(CAPACITY_NORMAL - postion, dc.send(sourceBuf, addr));
>     }
> Test result:
> RI 5.0 passes the test while Harmony fails. 
> 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-701) [classlib][nio] java.nio.channels.DatagramChannel.send(ByteBuffer, SocketAddress) sends data incorrectly if the position of ByteBuffer is not zero.

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


Verified by Andrew.


> [classlib][nio] java.nio.channels.DatagramChannel.send(ByteBuffer, SocketAddress) sends data incorrectly if the position of ByteBuffer is not zero.
> ---------------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: HARMONY-701
>          URL: http://issues.apache.org/jira/browse/HARMONY-701
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Andrew Zhang
>     Assignee: Tim Ellison
>  Attachments: nio.diff
>
> java.nio.channels.DatagramChannel.send(ByteBuffer, SocketAddress) sends data incorrectly if the position of ByteBuffer is not zero.
> Following test case reproduces the bug. 
> I'll upload a patch soon. Thanks! 
> Test case:
>     public void test_send_LBuffer_LSocketAddress_PositionNotZero()  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];
>         // send ByteBuffer whose position is not zero
>         ByteBuffer sourceBuf = ByteBuffer.wrap(sourceArray);
>         sourceBuf.position(postion);
>         assertEquals(CAPACITY_NORMAL - postion, dc.send(sourceBuf, addr));
>     }
> Test result:
> RI 5.0 passes the test while Harmony fails. 
> 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-701) [classlib][nio] java.nio.channels.DatagramChannel.send(ByteBuffer, SocketAddress) sends data incorrectly if the position of ByteBuffer is not zero.

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

Andrew Zhang commented on HARMONY-701:
--------------------------------------

Hello Tim,

The fix looks good, many thanks!

Best regards,
Andrew

> [classlib][nio] java.nio.channels.DatagramChannel.send(ByteBuffer, SocketAddress) sends data incorrectly if the position of ByteBuffer is not zero.
> ---------------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: HARMONY-701
>          URL: http://issues.apache.org/jira/browse/HARMONY-701
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Andrew Zhang
>     Assignee: Tim Ellison
>  Attachments: nio.diff
>
> java.nio.channels.DatagramChannel.send(ByteBuffer, SocketAddress) sends data incorrectly if the position of ByteBuffer is not zero.
> Following test case reproduces the bug. 
> I'll upload a patch soon. Thanks! 
> Test case:
>     public void test_send_LBuffer_LSocketAddress_PositionNotZero()  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];
>         // send ByteBuffer whose position is not zero
>         ByteBuffer sourceBuf = ByteBuffer.wrap(sourceArray);
>         sourceBuf.position(postion);
>         assertEquals(CAPACITY_NORMAL - postion, dc.send(sourceBuf, addr));
>     }
> Test result:
> RI 5.0 passes the test while Harmony fails. 
> 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-701) [classlib][nio] java.nio.channels.DatagramChannel.send(ByteBuffer, SocketAddress) sends data incorrectly if the position of ByteBuffer is not zero.

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

Andrew Zhang updated HARMONY-701:
---------------------------------

    Attachment: nio.diff

Hello,

Would you please try my patch?

Thanks a lot!

Best regards,
Andrew

> [classlib][nio] java.nio.channels.DatagramChannel.send(ByteBuffer, SocketAddress) sends data incorrectly if the position of ByteBuffer is not zero.
> ---------------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: HARMONY-701
>          URL: http://issues.apache.org/jira/browse/HARMONY-701
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Andrew Zhang
>  Attachments: nio.diff
>
> java.nio.channels.DatagramChannel.send(ByteBuffer, SocketAddress) sends data incorrectly if the position of ByteBuffer is not zero.
> Following test case reproduces the bug. 
> I'll upload a patch soon. Thanks! 
> Test case:
>     public void test_send_LBuffer_LSocketAddress_PositionNotZero()  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];
>         // send ByteBuffer whose position is not zero
>         ByteBuffer sourceBuf = ByteBuffer.wrap(sourceArray);
>         sourceBuf.position(postion);
>         assertEquals(CAPACITY_NORMAL - postion, dc.send(sourceBuf, addr));
>     }
> Test result:
> RI 5.0 passes the test while Harmony fails. 
> 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-701) [classlib][nio] java.nio.channels.DatagramChannel.send(ByteBuffer, SocketAddress) sends data incorrectly if the position of ByteBuffer is not zero.

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

Tim Ellison reassigned HARMONY-701:
-----------------------------------

    Assign To: Tim Ellison

> [classlib][nio] java.nio.channels.DatagramChannel.send(ByteBuffer, SocketAddress) sends data incorrectly if the position of ByteBuffer is not zero.
> ---------------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: HARMONY-701
>          URL: http://issues.apache.org/jira/browse/HARMONY-701
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Andrew Zhang
>     Assignee: Tim Ellison
>  Attachments: nio.diff
>
> java.nio.channels.DatagramChannel.send(ByteBuffer, SocketAddress) sends data incorrectly if the position of ByteBuffer is not zero.
> Following test case reproduces the bug. 
> I'll upload a patch soon. Thanks! 
> Test case:
>     public void test_send_LBuffer_LSocketAddress_PositionNotZero()  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];
>         // send ByteBuffer whose position is not zero
>         ByteBuffer sourceBuf = ByteBuffer.wrap(sourceArray);
>         sourceBuf.position(postion);
>         assertEquals(CAPACITY_NORMAL - postion, dc.send(sourceBuf, addr));
>     }
> Test result:
> RI 5.0 passes the test while Harmony fails. 
> 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