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/21 12:21:15 UTC

[jira] Closed: (HARMONY-941) [classlib][nio] compatibility: java.nio.channels.FileChannel.truncate, transferTo throw different exeptions from RI.

     [ http://issues.apache.org/jira/browse/HARMONY-941?page=all ]

Paulex Yang closed HARMONY-941.
-------------------------------


Verified by Andrew.

> [classlib][nio] compatibility: java.nio.channels.FileChannel.truncate, transferTo  throw different exeptions from RI.
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-941
>                 URL: http://issues.apache.org/jira/browse/HARMONY-941
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Andrew Zhang
>         Assigned To: Paulex Yang
>         Attachments: nio.diff
>
>
> java.nio.channels.FileChannel.truncate, transferTo  throw different exeptions from RI.
> Following tests reproduce the problems:
>     public void test_truncateJ_Exception() throws Exception {
>         File testFile = File.createTempFile("test", "tmp");
>         testFile.deleteOnExit();
>         FileChannel readOnlyFileChannel = new FileInputStream(testFile)
>                 .getChannel();
>         try {
>             readOnlyFileChannel.truncate(-1);
>             fail("should throw IllegalArgumentException");
>         } catch (IllegalArgumentException e) {
>             // expected
>         }
>   }
>   public void test_transferTo_Exception() throws Exception {
>         File testFile1 = File.createTempFile("test", "tmp");
>         File testFile2 = File.createTempFile("test", "tmp");
>         testFile1.deleteOnExit();
>         testFile2.deleteOnExit();
>         FileChannel readOnlyFileChannel = new FileInputStream(testFile1)
>                 .getChannel();
>         FileChannel readWriteFileChannel = new RandomAccessFile(testFile2, "rw")
>                 .getChannel();
>         // first throws NonWritableChannelException even arguments are illegal.
>         try {
>             readWriteFileChannel.transferTo(-1, 10, readOnlyFileChannel);
>             fail("should throw NonWritableChannelException.");
>         } catch (NonWritableChannelException e) {
>             // expected
>         }
>         try {
>             readWriteFileChannel.transferTo(0, -1, readOnlyFileChannel);
>             fail("should throw NonWritableChannelException.");
>         } catch (NonWritableChannelException e) {
>             // expected
>         }
>   }
> Both tests pass against RI while fail against Harmony.
> I'll upload to fix these problems soon.
> 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