iaik.tc.tss.api.exceptions.common
Class TcTssException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by iaik.tc.tss.api.exceptions.common.TcTssException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
TcTcsException, TcTddlException, TcTpmException, TcTspException, TcTssKmLoadFailed

public abstract class TcTssException
extends java.lang.Exception

This exception forms the base for all other TSS exceptions. It holds the error code as specified by the TCG and the corresponding error message. Error codes, as defined by the TSS spec are 32bit unsigned integer values. Bits 16 to 31 are reserved for OS specific error coded. Bits 12 to 15 specify the TSS layer the error comes from. This can be TcTcsErrors.TSS_LAYER_TPM, TcTcsErrors.TSS_LAYER_TDDL, TcTcsErrors.TSS_LAYER_TCS or TcTcsErrors.TSS_LAYER_TSP. To get the layer the exception belongs to, use the getErrLayer() method. Bits 0 to 11 finally define the actual error code. Use getErrCode() to get this value. To obtain the full error code (not decomposed into its individual parts), use the getErrCodeFull() method.
Note that this class is an abstract class which means that this exception can not be thrown directly. Instead of that, for every TSS layer a specific exception is defined that inherits from this exception (e.g. TcTpmException. That means when catching a TcTssException, the layer the exception comes from can be determine by using the instanceOf operation instead of using the getErrLayer() method.

See Also:
Serialized Form

Constructor Summary
TcTssException(long errCode)
          This constructor takes the error code that is represented by this exception.
TcTssException(long errCode, java.lang.String message)
          This constructor takes the error code that is represented by this exception.
 
Method Summary
 long getErrCode()
          This method returns the error code represented by this exception.
 long getErrCodeFull()
          This method returns the full error code.
 long getErrLayer()
          This method returns the error layer represented by this exception.
 long getErrOsSpecific()
          This method returns the OS specific part of the error code.
 long getErrOsSpeific()
          Deprecated. 
 java.lang.String getMessage()
          Returns the error message.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TcTssException

public TcTssException(long errCode)
This constructor takes the error code that is represented by this exception. The error message is looked up based on this error code.

Parameters:
errCode - The error code represented by the exception.

TcTssException

public TcTssException(long errCode,
                      java.lang.String message)
This constructor takes the error code that is represented by this exception. The error message is looked up based on this error code. Additionally, a custom error message is appended to this default error message.

Parameters:
errCode - The error code represented by the exception.
message - Additional error message.
Method Detail

getErrLayer

public long getErrLayer()
This method returns the error layer represented by this exception.


getErrCode

public long getErrCode()
This method returns the error code represented by this exception. Note that the layer part has already been removed from this error code. To get the error layer use the getErrLayer() method.


getErrOsSpeific

@Deprecated
public long getErrOsSpeific()
Deprecated. 

This method returns the OS specific part of the error code. This will be all zeros most of the time. Deprecated due to spelling error.


getErrOsSpecific

public long getErrOsSpecific()
This method returns the OS specific part of the error code. This will be all zeros most of the time.


getErrCodeFull

public long getErrCodeFull()
This method returns the full error code. That is the error code NOT decomposed into individual parts (OS specific, layer, code).


getMessage

public java.lang.String getMessage()
Returns the error message.

Overrides:
getMessage in class java.lang.Throwable