javacardx.framework
Class ApplicationException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by javacardx.framework.ApplicationException

public final class ApplicationException
extends Exception

The class ApplicationException encapsulates generic checked exceptions that an application may throw.

The ApplicationException class provides a generic means for some auxiliary (e.g., application-defined) information to be set in the exception. The actual semantics of this information may be specific to the application throwing the exception.

A typical use case for this class is for exceptions thrown by methods of an SIO-based service or event.

Instances of this exception class are not bound to any context and can be passed between contexts without any restrictions. Objects created and returned by the methods of this class are owned by the caller. In particular, a call to the Throwable.getMessage() returns a String instance bound to the owner context of the caller. Note though that this is not the case for the getInfo() method; this method returns the same object that was passed to the constructor.

See Runtime Environment Specification for the Java Card Platform, Connected Edition, chapter 7 for details regarding transfer of ownership.

Since:
Java Card 3.0

Constructor Summary
ApplicationException()
          Constructs an ApplicationException with no (null) detail message and no (null) auxiliary application-defined information.
ApplicationException(String message)
          Constructs an ApplicationException with a detail message and no (null) auxiliary application-defined information.
ApplicationException(String message, Object info)
          Constructs an ApplicationException with a detail message and auxiliary (e.g., application-defined) information.
 
Method Summary
 Object getInfo()
          Returns the auxiliary (e.g., application-defined) information.
 
Methods inherited from class java.lang.Throwable
getMessage, printStackTrace, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ApplicationException

public ApplicationException(String message,
                            Object info)
Constructs an ApplicationException with a detail message and auxiliary (e.g., application-defined) information. Developers must account for context isolation and should typically provide the auxiliary information in the form of an SIO or an "implicitly transferable" object (or even an "explicitly transferable" object whose ownership has been transferred to the application intended to catch the exception).

Parameters:
message - the detail message (a null is permitted).
info - the auxiliary information (a null is permitted).

ApplicationException

public ApplicationException(String message)
Constructs an ApplicationException with a detail message and no (null) auxiliary application-defined information.

Parameters:
message - the detail message (a null is permitted).

ApplicationException

public ApplicationException()
Constructs an ApplicationException with no (null) detail message and no (null) auxiliary application-defined information.

Method Detail

getInfo

public Object getInfo()
Returns the auxiliary (e.g., application-defined) information.

Returns:
the auxiliary information, or null if no auxiliary information was provided.


Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.