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/25 09:08:15 UTC

[jira] Updated: (HARMONY-972) [classlib][nio]java.nio.channels.FileChannel.read(ByteBuffer,long) fails to read with a positioned bytebuffer correctly.

     [ http://issues.apache.org/jira/browse/HARMONY-972?page=all ]

Andrew Zhang updated HARMONY-972:
---------------------------------

    Attachment: nio.diff

Hello,

    Would you please try my patch?

Thanks!

Best regards,
Andrew

> [classlib][nio]java.nio.channels.FileChannel.read(ByteBuffer,long) fails to read with a positioned bytebuffer correctly.
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-972
>                 URL: http://issues.apache.org/jira/browse/HARMONY-972
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Andrew Zhang
>         Attachments: nio.diff
>
>
> Hi,
>     java.nio.channels.FileChannel.read(ByteBuffer,long) fails to read with a positioned bytebuffer correctly.
> testcase:
> public void test_readLByteBufferJ() throws Exception {
>         writeDataToFile(fileOfReadOnlyFileChannel);
>         ByteBuffer readBuffer = ByteBuffer.allocate(CAPACITY);
>         final int BUFFER_POSITION = 1;
>         readBuffer.position(BUFFER_POSITION);
>         final int POSITION = 2;
>         int result = readOnlyFileChannel.read(readBuffer, POSITION);
>         assertEquals(CONTENT_AS_BYTES_LENGTH - POSITION, result);
>         assertEquals(BUFFER_POSITION + result, readBuffer.position());
>         readBuffer.flip();
>         readBuffer.position(BUFFER_POSITION);
>         for (int i = POSITION; i < CONTENT_AS_BYTES_LENGTH; i++) {
>             assertEquals(CONTENT_AS_BYTES[i], readBuffer.get());
>         }
>     }
> It passes against RI while fails against Harmony

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