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/18 05:07:13 UTC

[jira] Created: (HARMONY-903) [classlib][nio] compatibility: java.nio.channels.FileChannel.write(ByteBuffer, long) throws different exception from RI.

[classlib][nio] compatibility: java.nio.channels.FileChannel.write(ByteBuffer, long) throws different exception from RI.
------------------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-903
                 URL: http://issues.apache.org/jira/browse/HARMONY-903
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Andrew Zhang
            Priority: Minor


java.nio.channels.FileChannel.write(ByteBuffer, long) throws different exception from RI. 
Following test reproduces the bug:
    public void test_writeLByteBufferJ_ReadOnly_Exception() throws Exception {
        File testFile = File.createTempFile("test", "tmp");
        testFile.deleteOnExit();
        FileChannel readOnlyFileChannel = new FileInputStream(testFile)
                .getChannel();

        ByteBuffer writeBuffer = null;
        readOnlyFileChannel.close();
        try {
            readOnlyFileChannel.write(writeBuffer, -1);
            fail("should throw NullPointerException");
        } catch (NullPointerException e) {
            // expected
        }

        writeBuffer = ByteBuffer.allocate(1);
        try {
            readOnlyFileChannel.write(writeBuffer, -1);
            fail("should throw IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // expected
        }

        try {
            readOnlyFileChannel.write(writeBuffer, 0);
            fail("should throw NonWritableChannelException");
        } catch (NonWritableChannelException e) {
            // expected
        }
    }

The test passes against RI while fails against Harmony.

I'll upload a patch to fix this 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-903) [classlib][nio] compatibility: java.nio.channels.FileChannel.write(ByteBuffer, long) throws different exception from RI.

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

Andrew Zhang updated HARMONY-903:
---------------------------------

    Attachment: nio.diff

Hello,

Would you please try my patch?

Thanks!

Best regards,
Andrew

> [classlib][nio] compatibility: java.nio.channels.FileChannel.write(ByteBuffer, long) throws different exception from RI.
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-903
>                 URL: http://issues.apache.org/jira/browse/HARMONY-903
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Andrew Zhang
>            Priority: Minor
>         Attachments: nio.diff
>
>
> java.nio.channels.FileChannel.write(ByteBuffer, long) throws different exception from RI. 
> Following test reproduces the bug:
>     public void test_writeLByteBufferJ_ReadOnly_Exception() throws Exception {
>         File testFile = File.createTempFile("test", "tmp");
>         testFile.deleteOnExit();
>         FileChannel readOnlyFileChannel = new FileInputStream(testFile)
>                 .getChannel();
>         ByteBuffer writeBuffer = null;
>         readOnlyFileChannel.close();
>         try {
>             readOnlyFileChannel.write(writeBuffer, -1);
>             fail("should throw NullPointerException");
>         } catch (NullPointerException e) {
>             // expected
>         }
>         writeBuffer = ByteBuffer.allocate(1);
>         try {
>             readOnlyFileChannel.write(writeBuffer, -1);
>             fail("should throw IllegalArgumentException");
>         } catch (IllegalArgumentException e) {
>             // expected
>         }
>         try {
>             readOnlyFileChannel.write(writeBuffer, 0);
>             fail("should throw NonWritableChannelException");
>         } catch (NonWritableChannelException e) {
>             // expected
>         }
>     }
> The test passes against RI while fails against Harmony.
> I'll upload a patch to fix this 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-903) [classlib][nio] compatibility: java.nio.channels.FileChannel.write(ByteBuffer, long) throws different exception from RI.

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

Paulex Yang resolved HARMONY-903.
---------------------------------

    Resolution: Fixed

Patch applied at revision 423008, thanks a lot for the fix, please verify this fully resolve the problem as you expected.

> [classlib][nio] compatibility: java.nio.channels.FileChannel.write(ByteBuffer, long) throws different exception from RI.
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-903
>                 URL: http://issues.apache.org/jira/browse/HARMONY-903
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Andrew Zhang
>         Assigned To: Paulex Yang
>            Priority: Minor
>         Attachments: nio.diff
>
>
> java.nio.channels.FileChannel.write(ByteBuffer, long) throws different exception from RI. 
> Following test reproduces the bug:
>     public void test_writeLByteBufferJ_ReadOnly_Exception() throws Exception {
>         File testFile = File.createTempFile("test", "tmp");
>         testFile.deleteOnExit();
>         FileChannel readOnlyFileChannel = new FileInputStream(testFile)
>                 .getChannel();
>         ByteBuffer writeBuffer = null;
>         readOnlyFileChannel.close();
>         try {
>             readOnlyFileChannel.write(writeBuffer, -1);
>             fail("should throw NullPointerException");
>         } catch (NullPointerException e) {
>             // expected
>         }
>         writeBuffer = ByteBuffer.allocate(1);
>         try {
>             readOnlyFileChannel.write(writeBuffer, -1);
>             fail("should throw IllegalArgumentException");
>         } catch (IllegalArgumentException e) {
>             // expected
>         }
>         try {
>             readOnlyFileChannel.write(writeBuffer, 0);
>             fail("should throw NonWritableChannelException");
>         } catch (NonWritableChannelException e) {
>             // expected
>         }
>     }
> The test passes against RI while fails against Harmony.
> I'll upload a patch to fix this 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-903) [classlib][nio] compatibility: java.nio.channels.FileChannel.write(ByteBuffer, long) throws different exception from RI.

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

Paulex Yang closed HARMONY-903.
-------------------------------

    Estimated Complexity: Novice

Verified by Andrew.

> [classlib][nio] compatibility: java.nio.channels.FileChannel.write(ByteBuffer, long) throws different exception from RI.
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-903
>                 URL: http://issues.apache.org/jira/browse/HARMONY-903
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Andrew Zhang
>         Assigned To: Paulex Yang
>            Priority: Minor
>         Attachments: nio.diff
>
>
> java.nio.channels.FileChannel.write(ByteBuffer, long) throws different exception from RI. 
> Following test reproduces the bug:
>     public void test_writeLByteBufferJ_ReadOnly_Exception() throws Exception {
>         File testFile = File.createTempFile("test", "tmp");
>         testFile.deleteOnExit();
>         FileChannel readOnlyFileChannel = new FileInputStream(testFile)
>                 .getChannel();
>         ByteBuffer writeBuffer = null;
>         readOnlyFileChannel.close();
>         try {
>             readOnlyFileChannel.write(writeBuffer, -1);
>             fail("should throw NullPointerException");
>         } catch (NullPointerException e) {
>             // expected
>         }
>         writeBuffer = ByteBuffer.allocate(1);
>         try {
>             readOnlyFileChannel.write(writeBuffer, -1);
>             fail("should throw IllegalArgumentException");
>         } catch (IllegalArgumentException e) {
>             // expected
>         }
>         try {
>             readOnlyFileChannel.write(writeBuffer, 0);
>             fail("should throw NonWritableChannelException");
>         } catch (NonWritableChannelException e) {
>             // expected
>         }
>     }
> The test passes against RI while fails against Harmony.
> I'll upload a patch to fix this 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-903) [classlib][nio] compatibility: java.nio.channels.FileChannel.write(ByteBuffer, long) throws different exception from RI.

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

Paulex Yang reassigned HARMONY-903:
-----------------------------------

    Assignee: Paulex Yang

> [classlib][nio] compatibility: java.nio.channels.FileChannel.write(ByteBuffer, long) throws different exception from RI.
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-903
>                 URL: http://issues.apache.org/jira/browse/HARMONY-903
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Andrew Zhang
>         Assigned To: Paulex Yang
>            Priority: Minor
>         Attachments: nio.diff
>
>
> java.nio.channels.FileChannel.write(ByteBuffer, long) throws different exception from RI. 
> Following test reproduces the bug:
>     public void test_writeLByteBufferJ_ReadOnly_Exception() throws Exception {
>         File testFile = File.createTempFile("test", "tmp");
>         testFile.deleteOnExit();
>         FileChannel readOnlyFileChannel = new FileInputStream(testFile)
>                 .getChannel();
>         ByteBuffer writeBuffer = null;
>         readOnlyFileChannel.close();
>         try {
>             readOnlyFileChannel.write(writeBuffer, -1);
>             fail("should throw NullPointerException");
>         } catch (NullPointerException e) {
>             // expected
>         }
>         writeBuffer = ByteBuffer.allocate(1);
>         try {
>             readOnlyFileChannel.write(writeBuffer, -1);
>             fail("should throw IllegalArgumentException");
>         } catch (IllegalArgumentException e) {
>             // expected
>         }
>         try {
>             readOnlyFileChannel.write(writeBuffer, 0);
>             fail("should throw NonWritableChannelException");
>         } catch (NonWritableChannelException e) {
>             // expected
>         }
>     }
> The test passes against RI while fails against Harmony.
> I'll upload a patch to fix this 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-903) [classlib][nio] compatibility: java.nio.channels.FileChannel.write(ByteBuffer, long) throws different exception from RI.

Posted by "Andrew Zhang (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-903?page=comments#action_12421809 ] 
            
Andrew Zhang commented on HARMONY-903:
--------------------------------------

Hi Paulex,

The fix looks good. Many thanks!

Best regards,
Andrew

> [classlib][nio] compatibility: java.nio.channels.FileChannel.write(ByteBuffer, long) throws different exception from RI.
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-903
>                 URL: http://issues.apache.org/jira/browse/HARMONY-903
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Andrew Zhang
>         Assigned To: Paulex Yang
>            Priority: Minor
>         Attachments: nio.diff
>
>
> java.nio.channels.FileChannel.write(ByteBuffer, long) throws different exception from RI. 
> Following test reproduces the bug:
>     public void test_writeLByteBufferJ_ReadOnly_Exception() throws Exception {
>         File testFile = File.createTempFile("test", "tmp");
>         testFile.deleteOnExit();
>         FileChannel readOnlyFileChannel = new FileInputStream(testFile)
>                 .getChannel();
>         ByteBuffer writeBuffer = null;
>         readOnlyFileChannel.close();
>         try {
>             readOnlyFileChannel.write(writeBuffer, -1);
>             fail("should throw NullPointerException");
>         } catch (NullPointerException e) {
>             // expected
>         }
>         writeBuffer = ByteBuffer.allocate(1);
>         try {
>             readOnlyFileChannel.write(writeBuffer, -1);
>             fail("should throw IllegalArgumentException");
>         } catch (IllegalArgumentException e) {
>             // expected
>         }
>         try {
>             readOnlyFileChannel.write(writeBuffer, 0);
>             fail("should throw NonWritableChannelException");
>         } catch (NonWritableChannelException e) {
>             // expected
>         }
>     }
> The test passes against RI while fails against Harmony.
> I'll upload a patch to fix this 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