com.sap.ip.collaboration.core.api.util.exception

Class BaseException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by com.sap.ip.collaboration.core.api.util.exception.BaseException
All Implemented Interfaces:
IBaseException, Serializable
Direct Known Subclasses:
AttachmentException, ExtensionException, GroupwareException, IncompleteOperationException, NoSuchRoomRoleException, RoomInstantiationException, RoomVersionException, SCFException, TemplateInstantiationException, UserPhotoException

public abstract class BaseException
extends Exception
implements IBaseException, Serializable

Root class for exceptions with internationalizable error texts

Subclasses of this exception class support internationalizable error texts, exception chaining and logging.

Copyright: Copyright (c) 2002 Company: SAP Portals

See Also:
Serialized Form

Field Summary
static boolean DONT_LOG
          constant for not logging the exception
static boolean LOG
          constant for logging the exception
 
Constructor Summary
BaseException(boolean log)
          constructs a new BaseException without a message
BaseException(IText aText, boolean log)
          constructs a new BaseException with a causing throwable for exception chaining and uses the default mechanism to read message texts
BaseException(String aTextKey, boolean log)
          constructs a new BaseException with a causing throwable for exception chaining and uses the default mechanism to read message texts
BaseException(String aTextKey, Object[] messageParameters, boolean log)
          constructs a new BaseException with a causing throwable for exception chaining and uses the default mechanism to read message texts
BaseException(String aTextKey, Object[] messageParameters, TextBundle aTextBundle, boolean log)
          constructs a new BaseException with a causing throwable for exception chaining and an independent message bundle
BaseException(Throwable aCausingThrowable, boolean log)
          constructs a new BaseException with a causing throwable for exception chaining.
BaseException(Throwable aCausingThrowable, IText aText, boolean log)
          constructs a new BaseException with a causing throwable for exception chaining and a given internationalizable text
BaseException(Throwable aCausingThrowable, String aTextKey, boolean log)
          constructs a new BaseException with a causing throwable for exception chaining and uses the default mechanism to read message texts
BaseException(Throwable aCausingThrowable, String aTextKey, Object[] messageParameters, boolean log)
          constructs a new BaseException with a causing throwable for exception chaining and uses the default mechanism to read message texts
BaseException(Throwable aCausingThrowable, String aTextKey, Object[] messageParameters, TextBundle aTextBundle, boolean log)
          constructs a new BaseException with a causing throwable for exception chaining and an independent message bundle
BaseException(Throwable aCausingThrowable, String aTextKey, TextBundle aTextBundle, boolean log)
          constructs a new BaseException with a causing throwable for exception chaining and an independent message bundle
 
Method Summary
 Throwable getCausingThrowable()
          returns the causing throwable if there is one or null
 String getMessage()
          returns an error message formated with the logging locale
 String getMessage(Locale locale)
          returns a locale specific short error message.
 Throwable getRootThrowable()
          returns the top most throwable in the exception chain.
 IText getText()
          returns the text object representing the error message
 boolean isLogged()
          checks, if the exception was already logged
 void logException()
          logs the exception using the standard SAP logger
 void printStackTrace()
          overwrites the original printStackTrace method to also print chained stack traces.
 void printStackTrace(PrintStream stream)
          overwrites the original printStackTrace method to also print chained stack traces.
 void printStackTrace(PrintWriter writer)
          overwrites the original printStackTrace method to also print chained stack traces.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG

public static final boolean LOG
constant for logging the exception

See Also:
Constant Field Values

DONT_LOG

public static final boolean DONT_LOG
constant for not logging the exception

See Also:
Constant Field Values
Constructor Detail

BaseException

public BaseException(boolean log)
constructs a new BaseException without a message

Parameters:
log - true, if exception should be logged

BaseException

public BaseException(String aTextKey,
                     boolean log)
constructs a new BaseException with a causing throwable for exception chaining and uses the default mechanism to read message texts

Parameters:
aTextKey - key for an internationalized message, or null if no new message should be set
log - true, if exception should be logged

BaseException

public BaseException(IText aText,
                     boolean log)
constructs a new BaseException with a causing throwable for exception chaining and uses the default mechanism to read message texts

Parameters:
aText - internationalizable text, or null if no new message should be set
log - true, if exception should be logged

BaseException

public BaseException(String aTextKey,
                     Object[] messageParameters,
                     boolean log)
constructs a new BaseException with a causing throwable for exception chaining and uses the default mechanism to read message texts

Parameters:
aTextKey - key for an internationalized message, or null if no new message should be set
messageParameters - objects to fill message place holders, or null if there are no parameters
log - true, if exception should be logged

BaseException

public BaseException(String aTextKey,
                     Object[] messageParameters,
                     TextBundle aTextBundle,
                     boolean log)
constructs a new BaseException with a causing throwable for exception chaining and an independent message bundle

Parameters:
aTextKey - key for an internationalized message, or null if no new message should be set
messageParameters - objects to fill message place holders, or null if there are no parameters
aTextBundle - message bundle to read the text message from, or null to use the default mechanism to read text messages
log - true, if exception should be logged

BaseException

public BaseException(Throwable aCausingThrowable,
                     boolean log)
constructs a new BaseException with a causing throwable for exception chaining. The exception message is taken from the root exception.

Parameters:
aCausingThrowable - causing throwable for exception chaining, of null if there is no causing exception
log - true, if exception should be logged

BaseException

public BaseException(Throwable aCausingThrowable,
                     String aTextKey,
                     TextBundle aTextBundle,
                     boolean log)
constructs a new BaseException with a causing throwable for exception chaining and an independent message bundle

Parameters:
aCausingThrowable - causing throwable for exception chaining, of null if there is no causing exception
aTextKey - key for an internationalized message, or null if no new message should be set
aTextBundle - message bundle to read the text message from, or null to use the default mechanism to read text messages
log - true, if exception should be logged

BaseException

public BaseException(Throwable aCausingThrowable,
                     String aTextKey,
                     boolean log)
constructs a new BaseException with a causing throwable for exception chaining and uses the default mechanism to read message texts

Parameters:
aCausingThrowable - causing throwable for exception chaining, of null if there is no causing exception
aTextKey - key for an internationalized message, or null if no new message should be set
log - true, if exception should be logged

BaseException

public BaseException(Throwable aCausingThrowable,
                     IText aText,
                     boolean log)
constructs a new BaseException with a causing throwable for exception chaining and a given internationalizable text

Parameters:
aCausingThrowable - causing throwable for exception chaining, of null if there is no causing exception
aText - internationalizable message, or null if no new message should be set
log - true, if exception should be logged

BaseException

public BaseException(Throwable aCausingThrowable,
                     String aTextKey,
                     Object[] messageParameters,
                     boolean log)
constructs a new BaseException with a causing throwable for exception chaining and uses the default mechanism to read message texts

Parameters:
aCausingThrowable - causing throwable for exception chaining, of null if there is no causing exception
aTextKey - key for an internationalized message, or null if no new message should be set
messageParameters - objects to fill message place holders, or null if there are no parameters
log - true, if exception should be logged

BaseException

public BaseException(Throwable aCausingThrowable,
                     String aTextKey,
                     Object[] messageParameters,
                     TextBundle aTextBundle,
                     boolean log)
constructs a new BaseException with a causing throwable for exception chaining and an independent message bundle

Parameters:
aCausingThrowable - causing throwable for exception chaining, of null if there is no causing exception
aTextKey - key for an internationalized message, or null if no new message should be set
messageParameters - objects to fill message place holders, or null if there are no parameters
aTextBundle - message bundle to read the text message from, or null to use the default mechanism to read text messages
log - true, if exception should be logged
Method Detail

logException

public void logException()
logs the exception using the standard SAP logger

Specified by:
logException in interface IBaseException

isLogged

public boolean isLogged()
checks, if the exception was already logged

Specified by:
isLogged in interface IBaseException

getMessage

public String getMessage()
returns an error message formated with the logging locale

Specified by:
getMessage in interface IBaseException
Overrides:
getMessage in class Throwable

getMessage

public String getMessage(Locale locale)
returns a locale specific short error message.

Specified by:
getMessage in interface IBaseException
Parameters:
locale - the locale for the message

getText

public IText getText()
returns the text object representing the error message

Specified by:
getText in interface IBaseException

printStackTrace

public void printStackTrace()
overwrites the original printStackTrace method to also print chained stack traces.

Specified by:
printStackTrace in interface IBaseException
Overrides:
printStackTrace in class Throwable

printStackTrace

public void printStackTrace(PrintStream stream)
overwrites the original printStackTrace method to also print chained stack traces.

Specified by:
printStackTrace in interface IBaseException
Overrides:
printStackTrace in class Throwable
Parameters:
stream - PrintStream for output

printStackTrace

public void printStackTrace(PrintWriter writer)
overwrites the original printStackTrace method to also print chained stack traces.

Specified by:
printStackTrace in interface IBaseException
Overrides:
printStackTrace in class Throwable
Parameters:
writer - PrintWriter for output

getCausingThrowable

public Throwable getCausingThrowable()
returns the causing throwable if there is one or null

Specified by:
getCausingThrowable in interface IBaseException
Returns:
causing exception or null, if there is no causing throwable

getRootThrowable

public Throwable getRootThrowable()
returns the top most throwable in the exception chain. If the exception is the top most in the chain the method returns this.

Specified by:
getRootThrowable in interface IBaseException
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] KMC-COLL [sap.com] tc/kmc/coll/util api EP-KM-COL
[sap.com] KMC-CM [sap.com] tc/km/frwk api EP-KM-CM
[sap.com] KMC-WPC [sap.com] tc/kmc/wpc/wpcfacade api EP-PIN-WPC-WCM


Copyright 2011 SAP AG Complete Copyright Notice