You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Paulex Yang (JIRA)" <ji...@apache.org> on 2006/07/18 11:11:15 UTC

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

     [ 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