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/14 03:48:30 UTC

[jira] Commented: (HARMONY-849) [classlib][nio] FileChannel.read(ByteBuffer[] dsts) returns incorrect value and doesn't set the position of ByteBuffer[] in some cases.

    [ http://issues.apache.org/jira/browse/HARMONY-849?page=comments#action_12420976 ] 

Andrew Zhang commented on HARMONY-849:
--------------------------------------

Hello George,

The fix looks good. Many thanks!

Best regards,
Andrew

> [classlib][nio] FileChannel.read(ByteBuffer[] dsts) returns incorrect value and doesn't set the position of ByteBuffer[] in some cases.
> ---------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: HARMONY-849
>          URL: http://issues.apache.org/jira/browse/HARMONY-849
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Andrew Zhang
>     Assignee: George Harley
>  Attachments: luni.native.diff, nio.diff
>
> FileChannel.read(ByteBuffer[] dsts) returns incorrect value and doesn't set the position of ByteBuffer[] in some cases.
> Following test reproduces the bug:
>     public void test_read$LByteBuffer() throws Exception {
>         final int CAPACITY = 64;
>         final String content = "TEST CONTENT";
>         final long contentLength = content.length();
>         
>         File file = File.createTempFile("File_of_readOnlyFileChannel", "tmp");
>         FileOutputStream fos = new FileOutputStream(file);
>         try {
>             fos.write(content.getBytes());
>         } finally {
>             fos.close();
>         }
>         ByteBuffer[] readBuffers = new ByteBuffer[2];
>         readBuffers[0] = ByteBuffer.allocate(CAPACITY);
>         readBuffers[1] = ByteBuffer.allocate(CAPACITY);
>         FileChannel filechannel = new FileInputStream(file).getChannel();
>         long readCount = filechannel.read(readBuffers);
>         // Harmony fails on following two assertions
>         assertEquals(contentLength, readCount);
>         assertEquals(contentLength, readBuffers[0].position());
>     }
> The test passes against RI while fails against Harmony.
> I'll upload a patch to fix the problem soon. 
> Thanks!
> 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