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

Second invocation of the method for same object with null reference lead to VM c

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_nt

      Description



      Name: akC45999 Date: 08/12/98


      In the example below second invocation of the method "run" and
      therefore of the method "justPrivateMethod" for the static field
      "always_null" lead to illegal memory access in VM instead throw the NullPointerException.
      The field "always_null" contains null reference.

      See log below.

      An example:
      --------------------------------------------------------------------------

      import java.io.PrintStream;

      public class invokespecial02102 implements Runnable{

      public static invokespecial02102 always_null;
      public static Runnable always_invokespecial02102 = new invokespecial02102();

              public static void main(String args[]) {
                      System.exit(run(args, System.out) + 95/*STATUS_TEMP*/);
              }

              public static int run(String args[], PrintStream out) {
      always_invokespecial02102.run();
      if(((invokespecial02102)always_invokespecial02102).failed) {
      out.println("Failed on first invocation.");
      return 2/*STATUS_FAILED*/;
      }
      always_invokespecial02102.run();
      if(((invokespecial02102)always_invokespecial02102).failed) {
      out.println("Failed on second invocation.");
      return 2/*STATUS_FAILED*/;
      }
      return 0/*STATUS_PASSED*/;
              }

      public void run() { // nothing more than invoker of private method for null objectref
      try {
      always_null.justPrivateMethod();
      } catch (NullPointerException e) {
      return;
      }
      failed = true; // the entire test failed
      }

      private boolean failed = false;

      private void justPrivateMethod() {
      failed = true; // test failed if this method ever invoked
      }
      }

      =====================================================
      A log:

      >java -version
      java version "1.2beta4"
      Classic VM (build JDK-1.2beta4-K, native threads, symcjit)

      >java -verify invokespecial02102

      The following message is displayed in window named "java.exe - Application error" when this test running:
      <The instruction at "0x50427557" referenced memory at "0x00000018". The memory could not be "written".>

      --------------------------------------------------------------------------
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                rfqsunw Rfq Rfq (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: