com.sap.tc.mobile.exception
Class BaseException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by com.sap.tc.mobile.exception.BaseException
All Implemented Interfaces:
IBaseException, java.io.Serializable

public class BaseException
extends java.lang.Exception
implements IBaseException

Base class for all other subclasses of Exception. Objects of type BaseException can optionally hold a reference to another Throwable object (root cause), a language independent message object of type LocalizableText.

See Also:
IBaseException, BaseRuntimeException, Serialized Form

Field Summary
 
Fields inherited from interface com.sap.tc.mobile.exception.IBaseException
audit
 
Constructor Summary
BaseException(BaseExceptionInfo info)
          Constructs an exception out of a BaseExceptionInfo object.
BaseException(Location loc, MsgObject msgObject, java.lang.Object[] args, java.lang.Throwable cause)
          Constructs an exception with a localizable text message.
 
Method Summary
 java.lang.Throwable getCause()
          Getter method for root cause.
 java.lang.String getLocalizedMessage()
          Gets localized message.
 Location getLogLocation()
          Getter method for logging location.
 java.lang.String getMessage()
           
 java.lang.String getNestedLocalizedMessage()
          Chains localized messages of the nested exceptions.
 java.lang.String getNestedStackTraceString()
          Chains the stack trace information of nested exceptions.
 java.lang.String getStackTraceString()
          Gets stack trace information of this exception only.
 java.lang.String getSystemStackTraceString()
          Gets the stack information of this exception in respect of the current system environment.
 java.lang.Throwable initCause(java.lang.Throwable cause)
          Initializes the cause of this exception to the specified value.
 void printStackTrace()
          Prints this exception and its backtrace to the standard error stream.
 void printStackTrace(java.io.PrintStream s)
          Prints this exception object and its backtrace to the specified print stream.
 void printStackTrace(java.io.PrintWriter s)
          Prints this exception object and its backtrace to the specified print writer.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BaseException

public BaseException(BaseExceptionInfo info)
Constructs an exception out of a BaseExceptionInfo object.

Parameters:
info - BaseExceptionInfo

BaseException

public BaseException(Location loc,
                     MsgObject msgObject,
                     java.lang.Object[] args,
                     java.lang.Throwable cause)
Constructs an exception with a localizable text message.

Parameters:
loc - logging location which will be used in case of automatic tracing.
msgObject - message object.
args - arguments for the message (may be null if none).
cause - causing exception (may be null if none).
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.

Specified by:
initCause in interface IBaseException
Overrides:
initCause in class java.lang.Throwable
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

getCause

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

Specified by:
getCause in interface IBaseException
Overrides:
getCause in class java.lang.Throwable
Returns:
throwable object which caused this exception or null

getLocalizedMessage

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

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

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

Specified by:
getLocalizedMessage in interface IBaseException
Overrides:
getLocalizedMessage in class java.lang.Throwable
Returns:
message string or null

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.

Specified by:
getNestedLocalizedMessage in interface IBaseException
Returns:
message string or null

getSystemStackTraceString

public java.lang.String getSystemStackTraceString()
Gets the stack information of this exception in respect of the current system environment.

Specified by:
getSystemStackTraceString in interface IBaseException
Returns:
the stack trace as a string in respect of the current system

getStackTraceString

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

Specified by:
getStackTraceString in interface IBaseException
Returns:
the stack trace as a string without information of chained exceptions.

getNestedStackTraceString

public java.lang.String getNestedStackTraceString()
Chains the stack trace information of nested exceptions. The caused stack trace is displayed first.

Specified by:
getNestedStackTraceString in interface IBaseException
Returns:
the stack trace as a string

printStackTrace

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

Specified by:
printStackTrace in interface IBaseException
Overrides:
printStackTrace in class java.lang.Throwable

printStackTrace

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

Specified by:
printStackTrace in interface IBaseException
Overrides:
printStackTrace in class java.lang.Throwable
Parameters:
s - PrintStream to use for output

printStackTrace

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

Specified by:
printStackTrace in interface IBaseException
Overrides:
printStackTrace in class java.lang.Throwable
Parameters:
s - PrintWriter to use for output

getLogLocation

public Location getLogLocation()
Getter method for logging location.

If no location is specified, null is returned.

Returns:
logging location

getMessage

public java.lang.String getMessage()
Overrides:
getMessage in class java.lang.Throwable
See Also:
getLocalizedMessage()