Harmony
  1. Harmony
  2. HARMONY-1107

[classlib][io] compatibility: different exception order for FileInputStream("log").read(null, -1, 1)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Classlib
    • Labels:
      None

      Description

      The Harmony method java.io.FileInputStream(String).read(null, -1, 1) lead to NPE on RI and IndexOutOfBoundsException for harmony.

      ============ test.java ======================
      import java.io.*;

      public class test {
      public static void main(String[] args) throws IOException

      { new FileInputStream("log").read(null, -1, 1); }

      }
      =========================================

      Output:
      C:\tmp\tmp17>C:\jrockit-jdk1.5.0-windows-ia32\bin\java.exe -cp . -showversion test
      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))

      java.lang.NullPointerException
      at jrockit.io.NativeIOInputStream.read([BII)I(Unknown Source)
      at java.io.FileInputStream.read([BII)I(Unknown Source)
      at test.main(test.java:5)

      C:\tmp\tmp17>C:\harmony\classlib1.5\deploy\jdk\jre\bin\java.exe -cp . -showversion test
      java version 1.5 (subset)

      (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
      Exception in thread "main" java.lang.IndexOutOfBoundsException
      at java.io.FileInputStream.read(FileInputStream.java:277)
      at test.main(test.java:5)

      1. ASF.LICENSE.NOT.GRANTED--FileInputStream.patch
        0.8 kB
        Vladimir Ivanov
      2. FileInputStreamTest.patch
        0.8 kB
        Vladimir Ivanov

        Activity

        Hide
        Mark Hindess added a comment -

        Any chance of a patch with a regression test?

        Show
        Mark Hindess added a comment - Any chance of a patch with a regression test?
        Hide
        Vladimir Ivanov added a comment -

        in a few minutes

        Show
        Vladimir Ivanov added a comment - in a few minutes
        Hide
        Vladimir Ivanov added a comment -

        unit test.
        Seems, this issue was fixed already.

        Show
        Vladimir Ivanov added a comment - unit test. Seems, this issue was fixed already.
        Hide
        Tony Wu added a comment -

        It is no longer an issue in latest code (r448046)

        Show
        Tony Wu added a comment - It is no longer an issue in latest code (r448046)
        Hide
        Paulex Yang added a comment -

        Verified by Vladimir and Tony.

        Show
        Paulex Yang added a comment - Verified by Vladimir and Tony.

          People

          • Assignee:
            Unassigned
            Reporter:
            Vladimir Ivanov
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development