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

[jira] Created: (HARMONY-541) [classlib][nio-channels]java.nio.channels.SocketChannel.write(ByteBuffer) may cause an IllegalArgumentException

[classlib][nio-channels]java.nio.channels.SocketChannel.write(ByteBuffer) may cause an IllegalArgumentException
---------------------------------------------------------------------------------------------------------------

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

  Components: Classlib  
    Reporter: Paulex Yang
    Priority: Minor


java.nio.channels.SocketChannel.write(ByteBuffer) causes an IllegalArgumentException if the given buffer's position is not zero. The test case below reproduces this bug:

public void test_socketChannel_write() throws Exception {
        final String testStr = "Hello World";
        ByteBuffer readBuf = ByteBuffer.allocate(11);
        ByteBuffer buf = ByteBuffer.wrap(testStr.getBytes());
        ServerSocketChannel ssc = ServerSocketChannel.open();
        ssc.socket().bind(new InetSocketAddress(InetAddress.getLocalHost(),50001));
        SocketChannel sc = SocketChannel.open();
        sc.connect(new InetSocketAddress(InetAddress.getLocalHost(),50001));
        buf.position(2);
        ssc.accept().write(buf);
        assertEquals(9,sc.read(readBuf));
    }

RI 5.0 passes the test, however Harmony fails with an IllegalArgumentException in "ssc.accept().write(buf);"


-- 
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-541) [classlib][nio-channels]java.nio.channels.SocketChannel.write(ByteBuffer) may cause an IllegalArgumentException

Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-541?page=comments#action_12414340 ] 

Paulex Yang commented on HARMONY-541:
-------------------------------------

I've found more bugs in SocketChannel.read/write, and have raised Harmony-549(https://issues.apache.org/jira/browse/HARMONY-549) for them including this one, so I suggest to mark this one as duplicated with 549, sorry for the inconvenience caused. 

> [classlib][nio-channels]java.nio.channels.SocketChannel.write(ByteBuffer) may cause an IllegalArgumentException
> ---------------------------------------------------------------------------------------------------------------
>
>          Key: HARMONY-541
>          URL: http://issues.apache.org/jira/browse/HARMONY-541
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Paulex Yang
>     Priority: Minor

>
> java.nio.channels.SocketChannel.write(ByteBuffer) causes an IllegalArgumentException if the given buffer's position is not zero. The test case below reproduces this bug:
> public void test_socketChannel_write() throws Exception {
>         final String testStr = "Hello World";
>         ByteBuffer readBuf = ByteBuffer.allocate(11);
>         ByteBuffer buf = ByteBuffer.wrap(testStr.getBytes());
>         ServerSocketChannel ssc = ServerSocketChannel.open();
>         ssc.socket().bind(new InetSocketAddress(InetAddress.getLocalHost(),50001));
>         SocketChannel sc = SocketChannel.open();
>         sc.connect(new InetSocketAddress(InetAddress.getLocalHost(),50001));
>         buf.position(2);
>         ssc.accept().write(buf);
>         assertEquals(9,sc.read(readBuf));
>     }
> RI 5.0 passes the test, however Harmony fails with an IllegalArgumentException in "ssc.accept().write(buf);"

-- 
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-541) [classlib][nio-channels]java.nio.channels.SocketChannel.write(ByteBuffer) may cause an IllegalArgumentException

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


duplicate of HARMONY-549

> [classlib][nio-channels]java.nio.channels.SocketChannel.write(ByteBuffer) may cause an IllegalArgumentException
> ---------------------------------------------------------------------------------------------------------------
>
>          Key: HARMONY-541
>          URL: http://issues.apache.org/jira/browse/HARMONY-541
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Paulex Yang
>     Priority: Minor

>
> java.nio.channels.SocketChannel.write(ByteBuffer) causes an IllegalArgumentException if the given buffer's position is not zero. The test case below reproduces this bug:
> public void test_socketChannel_write() throws Exception {
>         final String testStr = "Hello World";
>         ByteBuffer readBuf = ByteBuffer.allocate(11);
>         ByteBuffer buf = ByteBuffer.wrap(testStr.getBytes());
>         ServerSocketChannel ssc = ServerSocketChannel.open();
>         ssc.socket().bind(new InetSocketAddress(InetAddress.getLocalHost(),50001));
>         SocketChannel sc = SocketChannel.open();
>         sc.connect(new InetSocketAddress(InetAddress.getLocalHost(),50001));
>         buf.position(2);
>         ssc.accept().write(buf);
>         assertEquals(9,sc.read(readBuf));
>     }
> RI 5.0 passes the test, however Harmony fails with an IllegalArgumentException in "ssc.accept().write(buf);"

-- 
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-541) [classlib][nio-channels]java.nio.channels.SocketChannel.write(ByteBuffer) may cause an IllegalArgumentException

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

    Resolution: Duplicate

see comment from the reporter

> [classlib][nio-channels]java.nio.channels.SocketChannel.write(ByteBuffer) may cause an IllegalArgumentException
> ---------------------------------------------------------------------------------------------------------------
>
>          Key: HARMONY-541
>          URL: http://issues.apache.org/jira/browse/HARMONY-541
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Paulex Yang
>     Priority: Minor

>
> java.nio.channels.SocketChannel.write(ByteBuffer) causes an IllegalArgumentException if the given buffer's position is not zero. The test case below reproduces this bug:
> public void test_socketChannel_write() throws Exception {
>         final String testStr = "Hello World";
>         ByteBuffer readBuf = ByteBuffer.allocate(11);
>         ByteBuffer buf = ByteBuffer.wrap(testStr.getBytes());
>         ServerSocketChannel ssc = ServerSocketChannel.open();
>         ssc.socket().bind(new InetSocketAddress(InetAddress.getLocalHost(),50001));
>         SocketChannel sc = SocketChannel.open();
>         sc.connect(new InetSocketAddress(InetAddress.getLocalHost(),50001));
>         buf.position(2);
>         ssc.accept().write(buf);
>         assertEquals(9,sc.read(readBuf));
>     }
> RI 5.0 passes the test, however Harmony fails with an IllegalArgumentException in "ssc.accept().write(buf);"

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