Site Tools


Sidebar

Smart Card Solution

User Manual

JavaCard API Samples

Java Card Specification

Knowledge Sharing

javacard:jcvm:7.5.11_athrow

7.5.11 athrow

Throw exception or error

Format

athrow

Forms

athrow = 147 (0x93)

Stack

…, objectref → objectref

Description

The objectref must be of type reference and must refer to an object that is an instance of class Throwable or of a subclass of Throwable. It is popped from the operand stack. The objectref is then thrown by searching the current frame ( Section 3.5, Frames) for the most recent catch clause that catches the class of objectref or one of its superclasses.

If a catch clause is found, it contains the location of the code intended to handle this exception. The pc register is reset to that location, the operand stack of the current frame is cleared, objectref is pushed back onto the operand stack, and execution continues. If no appropriate clause is found in the current frame, that frame is popped, the frame of its invoker is reinstated, and the objectref is rethrown.

If no catch clause is found that handles this exception, the virtual machine exits.

Runtime Exception

If objectref is null, athrow throws a NullPointerException instead of objectref.

Notes

In some circumstances, the athrow instruction may throw a SecurityException if the current context ( Section 3.4, Contexts) is not the owning context ( Section 3.4, Contexts) of the object referenced by objectref. The exact circumstances when the exception will be thrown are specified in Chapter 6 of the Runtime Environment Specification, Java Card Platform, Version 2.2.2.

javacard/jcvm/7.5.11_athrow.txt · Last modified: 2017/05/13 04:08 (external edit)