Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4085031

incorrect processing of errors in static class initialization

    XMLWordPrintable

    Details

      Description



      Name: laC46010 Date: 10/09/97



      JDK1.1.4 with JIT v. 57 fails to pass the following JCK-114a test cases:

      vm/concepts/exceptions/exceptions010/exceptions01001/exceptions01001.html
      vm/concepts/execution/execution058/execution05801/execution05801.html
      vm/concepts/execution/execution058/execution05802/execution05802.html
      vm/concepts/execution/execution059/execution05901/execution05901.html
      vm/concepts/execution/execution060/execution06001/execution06001.html
      vm/constantpool/InterfMethod/InterfMethod001/InterfMethod00101/InterfMethod00101.html
      vm/constantpool/ClassInterf/ClassInterf053/ClassInterf05301/ClassInterf05301.jtr

      throwing java.lang.NullPointerException instead of java.lang.ExceptionInInitializerError
      when static initialization of an class completes abruptly.

      See for example "exceptions01001" test below that produces the following output:

      --------------output----------------
      java.lang.NullPointerException
              at javasoft.sqe.tests.vm.exceptions.exceptions010.exceptions01001.exceptions01001.run(Compiled Code)
              at javasoft.sqe.tests.vm.exceptions.exceptions010.exceptions01001.exceptions01001.main(Compiled Code)------------------------------------

      ------------------------------------
      //File: @(#)exceptions01001.java 1.1 97/07/15
      //Copyright 07/15/97 Sun Microsystems, Inc. All Rights Reserved

      package javasoft.sqe.tests.vm.exceptions.exceptions010.exceptions01001;

      import java.io.PrintStream;

      public class exceptions01001 {

        public static int i1;

        public static int run(String argv[], PrintStream out) {


              try{

                      i1 = exceptions01001a.i1;

              } catch (ExceptionInInitializerError e) {
                      out.println("OKAY!");
                      return 0;
              };

              out.println("BAD!");
              return 2;

        }

        public static void main(String argv[]) {
              System.exit(run(argv, System.out) + 95/*STATUS_TEMP*/);
        }
      }
      ---------------------------------------------------------
      //File: @(#)exceptions01001a.java 1.1 97/07/15
      //Copyright 07/15/97 Sun Microsystems, Inc. All Rights Reserved

      package javasoft.sqe.tests.vm.exceptions.exceptions010.exceptions01001;

      import java.io.PrintStream;

      public class exceptions01001a {

        public static int i2 = 1;
        public static int i3 = 1;

        public static int i1;

        static {
              i1 = i2 / (i2 - i3);
        }

      }
      ---------------------------------------------------------


      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            dviswanasunw Deepa Viswanathan (Inactive)
            Reporter:
            leosunw Leo Leo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: