You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Ilya Okomin (JIRA)" <ji...@apache.org> on 2006/08/14 16:18:14 UTC

[jira] Updated: (HARMONY-1104) [classlib][io]Harmony does not throw IOException for java.io.FileInputStream.skip(Long n) when n<0 while RI does.

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

Ilya Okomin updated HARMONY-1104:
---------------------------------

    Attachment: FileInputStream.patch

patch with granted license to ASF

> [classlib][io]Harmony does not  throw IOException for java.io.FileInputStream.skip(Long n) when n<0 while RI does.
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1104
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1104
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Ilya Okomin
>            Priority: Trivial
>         Attachments: FileInputStream.patch, FileInputStream.patch, FileInputStreamTest.patch
>
>
> Harmony does not  throw IOException for java.io.FileInputStream.skip(Long n) when n<0 while RI does.
> Java 1.5.0. spec says:
> "Throws: IOException - if n is negative, or if an I/O error occurs.".
> ============== test.java ===================== 
> import java.io.FileInputStream;
> import java.io.File;
> import java.io.IOException;
> public class test {
>     public static void run_test() throws IOException{
>         File localFile = File.createTempFile("aaaa", "bbbb");
>         localFile.deleteOnExit();
>         FileInputStream fis = new FileInputStream(localFile);
>         try {
>             long res = fis.skip(-5);
>             System.out.println("fail: IOException must be thrown if number of bytes to skip <0");
>             System.out.println("skip = " + res);
>             return;
>         } catch (IOException e) {
>             // Expected IOException
>         } catch (Exception e) {
>             System.out.println("IOException expected, but found: " + e.getMessage());
>             return;
>         }
>         System.out.println("Test passed!");
>         fis.close();
>     }
>     public static void main(String[] args) {
>         try{
>             run_test();
>         } catch (Exception e) {
>             e.printStackTrace();
>         }
>     }
> }
> ========================================== 
> Output: 
> Harmony:
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = r424571, (Jul 22 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> fail: IOException must be thrown if number of bytes to skip <0
> skip = 9223372036854775803
> RI:
> java version "1.5.0"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
> BEA WebLogic JRockit(R) (build dra-38972-20041208-2001-win-ia32, R25.0.0-75, GC: System optimized over throughput (initial strategy singleparpar))
> Test passed!
> Suggested fix and regression test to it could be found in attach.

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