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

Catch clause doesn't work under certain conditions.

XMLWordPrintable

    • 1.2fcs
    • x86
    • windows_nt
    • Verified



      Name: akC45999 Date: 08/07/98


      Symantec jit (JDK-1.2beta4-K, JIT v. 3.00.063) can't catch an exception
      in some cases and fails to pass JCK12beta4 tests: putfield00802 and putfield00804.

      See example and log below.

      An example:
      --------------------------------------------------------------------------
      import java.io.PrintStream;

      public class putfield00802 {

      public double dou_v;
              public static putfield00802 always_null;

              public static void main(String args[]) {
                      System.exit(run(args, System.out) + 95/*STATUS_TEMP*/);
              }
       
              public static int run(String args[], PrintStream out) {
                      try {
                          always_null.dou_v = 17.0;

      //int i = 1; // (1)

                      } catch (NullPointerException e) { // (2)
                          return 0/*STATUS_PASSED*/;
                      }
                      return 2/*STATUS_FAILED*/;
              }
      }

      =======================================================
      Incidental statement within a try block affects proper execution of
      catch statement as it tries to catch NullPointerException.
      If line (1) is not commented, everything works as expected.
      If line (1) is commented, catch clause in line (2) doesn't work and stack trace is printed.
      A log:
      >javac putfield00802.java
      >java -version
      java version "1.2beta4"
      Classic VM (build JDK-1.2beta4-K, native threads, symcjit)

      >javac putfield00802.java
      >java putfield00802

      Exception in thread "main" java.lang.NullPointerException:
              at putf.run(putfield00802.java:13)
              at putf.main(putfield00802.java:9)
      >
      --------------------------------------------------------------------------
      ======================================================================

            dviswanasunw Deepa Viswanathan (Inactive)
            rfqsunw Rfq Rfq (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: