harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ilya Okomin (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-1104) [classlib][io]Harmony does not throw IOException for java.io.FileInputStream.skip(Long n) when n<0 while RI does.
Date Tue, 08 Aug 2006 11:51:14 GMT
[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, 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

        

Mime
View raw message