harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Zhang (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-972) [classlib][nio]java.nio.channels.FileChannel.read(ByteBuffer,long) fails to read with a positioned bytebuffer correctly.
Date Tue, 25 Jul 2006 07:02:13 GMT
[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


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

        

Mime
View raw message