javacard.framework
Class CardException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended byjavacard.framework.CardException
Direct Known Subclasses:
UserException

public class CardException
extends Exception

The CardException class defines a field reason and two accessor methods getReason() and setReason(). The reason field encapsulates exception cause identifier in Java Card. All Java Card checked Exception classes should extend CardException. This class also provides a resource-saving mechanism (throwIt() method) for using a JCRE owned instance of this class.


Constructor Summary
CardException(short reason)
          Construct a CardException instance with the specified reason.
 
Method Summary
 short getReason()
          Get reason code
 void setReason(short reason)
          Set reason code
static void throwIt(short reason)
          Throw the JCRE owned instance of CardException class with the specified reason.
 
Methods inherited from class java.lang.Object
equals
 

Constructor Detail

CardException

public CardException(short reason)
Construct a CardException instance with the specified reason. To conserve on resources, use the throwIt() method to use the JCRE owned instance of this class.

Parameters:
reason - the reason for the exception
Method Detail

getReason

public short getReason()
Get reason code

Returns:
the reason for the exception

setReason

public void setReason(short reason)
Set reason code

Parameters:
reason - the reason for the exception

throwIt

public static void throwIt(short reason)
                    throws CardException
Throw the JCRE owned instance of CardException class with the specified reason.

JCRE owned instances of exception classes are temporary JCRE 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 Java Card Runtime Environment (JCRE) Specification, section 6.2.1 for details.

Parameters:
reason - the reason for the exception
Throws:
CardException - always.


Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries.