You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Mikhail Loenko (JIRA)" <ji...@apache.org> on 2006/06/02 11:48:31 UTC
[jira] Resolved: (HARMONY-541)
[classlib][nio-channels]java.nio.channels.SocketChannel.write(ByteBuffer)
may cause an IllegalArgumentException
[ 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