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/12 10:29:29 UTC

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

[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


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


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

Posted by "Andrew Zhang (JIRA)" <ji...@apache.org>.
    [ 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


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

Posted by "Andrew Zhang (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-849?page=all ]

Andrew Zhang updated HARMONY-849:
---------------------------------

    Attachment: nio.diff

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


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

Posted by "George Harley (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-849?page=all ]

George Harley reassigned HARMONY-849:
-------------------------------------

    Assign To: George Harley

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


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

Posted by "Andrew Zhang (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-849?page=all ]

Andrew Zhang updated HARMONY-849:
---------------------------------

    Attachment: luni.native.diff

Hello,

Would you please try my patch?

The patch includes luni.native.diff and nio.diff

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
>  Attachments: luni.native.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


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

Posted by "George Harley (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-849?page=all ]
     
George Harley resolved HARMONY-849:
-----------------------------------

    Resolution: Fixed

Hi Andrew, 

Changes committed in revision 421577. Please could you verify that everything has been applied as expected. 

Many thanks for this fix. 

Best regards, 
George


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


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

Posted by "George Harley (JIRA)" <ji...@apache.org>.
     [ 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