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

Exception cannot be caught in the frame in which it is thrown.

XMLWordPrintable

    • 1.2alpha2
    • sparc
    • solaris_2.4
    • Not verified



      Name: laC46010 Date: 03/19/97



      Incorrect use of monitorexit cause an exception to be thrown,
      as described in section 6.4 of The Java Virtual Machine Instruction Set:

      "Otherwise, if the current thread is not the owner of the monitor,
      monitorexit throws an IllegalMonitorStateException."

      This exception can be caught in calling methods but
      cannot be caught in the current method.

      --------------------- monitorexit00802a.jasm
      package javasoft/sqe/tests/vm/monitorexit/monitorexit008/monitorexit00802;

      public class monitorexit00802a {

      public static Method run:"([Ljava/lang/String;Ljava/io/PrintStream;)I"
      stack 3 locals 2
      {
      new class java/lang/Object;
      dup;
      invokenonvirtual Method java/lang/Object.<init>:"()V";
      // dup; monitorenter;
      try t1;
      monitorexit; // as monitorenter commented,
      // this must cause an exception
      iconst_2/*STATUS_FAILED*/;
      ireturn;
      endtry t1;
      catch t1 java/lang/IllegalMonitorStateException;
      iconst_0/*STATUS_PASSED*/;
      ireturn;
      }

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


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

            sliangsunw Sheng Liang (Inactive)
            leosunw Leo Leo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: