**javacard.framework** ====Class CardRuntimeException ==== *[[javacard:java-card-api:object|java.lang.Object]] \\ *[[javacard:java-card-api:throwable|java.lang.Throwable]] \\ *[[javacard:java-card-api:exception|java.lang.Exception]] \\ *[[javacard:java-card-api:runtimeexception|java.lang.RuntimeException]] \\ **Direct Known Subclasses:** [[javacard:java-card-api:APDUException|APDUException]] , [[javacard:java-card-api:BioException|BioException]] , [[javacard:java-card-api:CryptoException|CryptoException]] , [[javacard:java-card-api:ExternalException|ExternalException]] , [[javacard:java-card-api:ISOException|ISOException]] , [[javacard:java-card-api:PINException|PINException]] , [[javacard:java-card-api:ServiceException|ServiceException]] , [[javacard:java-card-api:SystemException|SystemException]] , [[javacard:java-card-api:TLVException|TLVException]] , [[javacard:java-card-api:TransactionException|TransactionException]] , [[javacard:java-card-api:UtilException|UtilException]] ---- public class **CardRuntimeException**extends [[javacard:java-card-api:RuntimeException|RuntimeException]] The CardRuntimeException class defines a field reason and two accessor methods getReason() and setReason(). The reason field encapsulates an exception cause identifier in the Java Card platform. All Java Card platform unchecked Exception classes should extend CardRuntimeException. This class also provides a resource-saving mechanism (throwIt() method) for using a Java Card runtime environment-owned instance of this class. Even if a transaction is in progress, the update of the internal reason field shall not participate in the transaction. The value of the internal reason field of Java Card runtime environment-owned instance is reset to 0 on a tear or reset. ---- ^ Constructor Summary ^^ | **[[javacard:java-card-api:CardRuntimeException#CardRuntimeException(short)|CardRuntimeException]] **(short reason)          Constructs a CardRuntimeException instance with the specified reason. |   ^ Method Summary ^^ | ** short** | **[[javacard:java-card-api:CardRuntimeException#getReason()|getReason]] **()          Gets the reason code | | ** void** | **[[javacard:java-card-api:CardRuntimeException#setReason(short)|setReason]] **(short reason)          Sets the reason code. | | **static void** | **[[javacard:java-card-api:CardRuntimeException#throwIt(short)|throwIt]] **(short reason)          Throws the Java Card runtime environment-owned instance of the CardRuntimeException class with the specified reason. |   ^ Methods inherited from class java.lang.Object ^ | [[javacard:java-card-api:Object#equals(java.lang.Object)|equals]] |   ^ Constructor Detail ^ === CardRuntimeException === public **CardRuntimeException**(short reason) Constructs a CardRuntimeException instance with the specified reason. To conserve on resources, use the throwIt() method to employ the Java Card runtime environment-owned instance of this class. **Parameters:**reason - the reason for the exception ^ Method Detail ^ === getReason === public short **getReason**() Gets the reason code **Returns:**the reason for the exception ---- === setReason === public void **setReason**(short reason) Sets the reason code. Even if a transaction is in progress, the update of the internal reason field shall not participate in the transaction. **Parameters:**reason - the reason for the exception ---- === throwIt === public static void **throwIt**(short reason) throws [[javacard:java-card-api:CardRuntimeException|CardRuntimeException]] Throws the Java Card runtime environment-owned instance of the CardRuntimeException class with the specified reason. Java Card runtime environment-owned instances of exception classes are temporary Java Card runtime environment Entry Point Objects and can be accessed from any applet context. References to these temporary objects cannot be stored in class variables or instance variables or array components. See //Runtime Environment Specification for the Java Card Platform//, section 6.2.1 for details. **Parameters:**reason - the reason for the exception **Throws:** [[javacard:java-card-api:CardRuntimeException|CardRuntimeException]] - always