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

VM trows NullPointerException instead of StackOverflowError

XMLWordPrintable

    • x86
    • solaris_2.5.1



      Name: akC45999 Date: 10/16/98



      Test below shows that x86's (JDK12fcs-N with JIT on) VM trows
      NullPointerException instead of StackOverflowError. Similar bug was
      filed for the case when the method Runner is not synchronized (bug 4177154).

      --------------------------------- exceptions03102.java

      import java.io.PrintStream;

      public class exceptions03102 {

        public static int counter = 1;

        static synchronized int Runner() {
      counter = counter * -1;
      int i = counter;
      if(counter < 2) counter += Runner();
      return i;
        }

        public static void main(String argv[]) {

      try{
      Runner();
      } catch (Throwable e) {
      System.out.println(e);
      }
        }
      }

      ---------------------------------- output

      novo26% dotest
      java full version "JDK-1.2fcs-N"
      java.lang.NullPointerException
      novo26%

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

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

            never Tom Rodriguez
            rfqsunw Rfq Rfq (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: