com.sap.tc.mobile.exception
Class BaseExceptionInfo

java.lang.Object
  extended by com.sap.tc.mobile.exception.BaseExceptionInfo
All Implemented Interfaces:
java.io.Serializable

public class BaseExceptionInfo
extends java.lang.Object
implements java.io.Serializable

This class encapsulates the work necessary for implementing the IBaseException interface. It can be viewed as a helper class for exception classes implementing the IBaseException interface directly without inheriting from BaseException or BaseRuntimeException.

See Also:
IBaseException, BaseException, BaseRuntimeException, Serialized Form

Constructor Summary
BaseExceptionInfo(Location loc, MsgObject msgObject, java.lang.Object[] args, java.lang.Throwable action, java.lang.Throwable cause)
          Constructor for specifying a localizable message, the action cause and the root cause.
 
Method Summary
 java.lang.Throwable getCause()
          Getter method for root cause.
 java.lang.String getLocalizedMessage()
          Gets localized action message.
 Location getLogLocation()
          Getter method for logging location.
 java.lang.String getNestedLocalizedMessage()
          Chains localized messages of the nested exceptions.
 java.lang.String getNestedStackTraceString()
          Get stack trace information as a string.
 java.lang.String getStackTraceString()
          Gets stack trace information of this exception.
 java.lang.Throwable initCause(java.lang.Throwable cause)
          Initializes the cause of this exception to the specified value.
 void printStackTrace()
          Prints the action exception and its backtrace to the standard error stream.
 void printStackTrace(java.io.PrintStream s)
          Prints the action object and its backtrace to the specified print stream.
 void printStackTrace(java.io.PrintWriter s)
          Prints the action object and its backtrace to the specified print writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseExceptionInfo

public BaseExceptionInfo(Location loc,
                         MsgObject msgObject,
                         java.lang.Object[] args,
                         java.lang.Throwable action,
                         java.lang.Throwable cause)
Constructor for specifying a localizable message, the action cause and the root cause.

Parameters:
loc - logging location which will be used in case of automatic tracing.
msgObject - message object.
args - arguments for message (may be null if no arguments).
action - the caused throwable.
cause - the root cause (may be null).
Throws:
java.lang.IllegalArgumentException - if action is null or cause is equal to action (A throwable cannot be its own cause.)
Method Detail

initCause

public java.lang.Throwable initCause(java.lang.Throwable cause)
Initializes the cause of this exception to the specified value. (The cause is the throwable that caused this exception to get thrown.)

This method can be called at most once. That means the cause can be specified only once.

Parameters:
cause - the cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
Returns:
a reference to this exception instance.
Throws:
java.lang.IllegalArgumentException - if cause is this throwable. (A throwable cannot be its own cause.)
java.lang.IllegalStateException - if the cause was already set

printStackTrace

public void printStackTrace()
Prints the action exception and its backtrace to the standard error stream. This method prints a stack trace for the actionexception object on the error output stream that is the value of the field System.err.


printStackTrace

public void printStackTrace(java.io.PrintStream s)
Prints the action object and its backtrace to the specified print stream.

Parameters:
s - PrintStream to use for output

printStackTrace

public void printStackTrace(java.io.PrintWriter s)
Prints the action object and its backtrace to the specified print writer.

Parameters:
s - PrintWriter to use for output

getStackTraceString

public java.lang.String getStackTraceString()
Gets stack trace information of this exception. The stack traces of the nested exceptions are not chained.

Returns:
the stack trace of this exception as a string

getNestedStackTraceString

public java.lang.String getNestedStackTraceString()
Get stack trace information as a string. Chain the stack traces of nested exceptions. The caused trace is displayed first.

Returns:
the stack trace as a string

getCause

public java.lang.Throwable getCause()
Getter method for root cause.

Returns:
throwable object which caused this exception or null

getLocalizedMessage

public java.lang.String getLocalizedMessage()
Gets localized action message.

Returns:
message string.

getNestedLocalizedMessage

public java.lang.String getNestedLocalizedMessage()
Chains localized messages of the nested exceptions.

The default locale and the default time zone are used for localization.

These values have no effect if the finallyLocalize method has already been called.

Returns:
message string or null

getLogLocation

public Location getLogLocation()
Getter method for logging location.

If no location is specified, null is returned.

Returns:
logging location