harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paulex Yang (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-541) [classlib][nio-channels]java.nio.channels.SocketChannel.write(ByteBuffer) may cause an IllegalArgumentException
Date Thu, 01 Jun 2006 02:27:30 GMT
[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


Mime
View raw message