You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "George Harley (JIRA)" <ji...@apache.org> on 2006/04/05 15:31:44 UTC

[jira] Commented: (HARMONY-311) java.io.FileInputStream.skip(long n) returns incorrect value

    [ http://issues.apache.org/jira/browse/HARMONY-311?page=comments#action_12373351 ] 

George Harley commented on HARMONY-311:
---------------------------------------

Hi Nicolay, 

I converted your test into a JUnit test case and found that the Harmony behaviour is consistent with both the Sun 1.4.2 and Sun 5.0 releases. 

Best regards, 
George

> java.io.FileInputStream.skip(long n) returns incorrect value
> ------------------------------------------------------------
>
>          Key: HARMONY-311
>          URL: http://issues.apache.org/jira/browse/HARMONY-311
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: nikolay
>     Assignee: George Harley
>  Attachments: patch.txt
>
> According to  J2SE 1.4.2, 1.5.0 specifications for java.io.FileInputStream.skip(long n)
> the method should return the actual number of bytes skipped.
> The test listed below shows that the method returns incorrect value if parameter > number of bytes in file.
> import java.io.FileInputStream; 
> import java.io.IOException; 
> import java.io.File; 
> public class Test{ 
>     public static void main(String[] args) { 
>         FileInputStream toRet = null; 
>         try { 
>             File file = new File("FileInStream.tmp"); 
>             file.createNewFile(); 
>             toRet = new FileInputStream(file); 
>             System.out.println("skipped = " + toRet.skip(100)); 
>         } catch (IOException e) { 
>             e.printStackTrace(); 
>         } 
>     }    
> } 
> Output RI: 
> java.exe -showversion Test 
> java version "1.4.2_04"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
> BEA WebLogic JRockit(TM) 1.4.2_04 JVM  (build ari-31788-20040616-1132-win-ia32,
> Native Threads, GC strategy: parallel)
> skipped = 0
> Output harmony:
> java -showversion Test 
> java version 1.4.2 (subset)
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.
> skipped = 100 

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