You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "George Harley (JIRA)" <ji...@apache.org> on 2006/07/17 16:04:22 UTC
[jira] Closed: (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=all ]
George Harley closed HARMONY-849.
---------------------------------
Verified by 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
> Issue Type: Bug
> Components: Classlib
> Reporter: Andrew Zhang
> Assigned To: 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