com.ibm.tws.util.exception
Class TWSException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended bycom.ibm.tws.util.exception.TWSException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ConnException, ConnPlanException, ValidatorException

public class TWSException
extends java.lang.Exception

Base class for TWS exceptions.

See Also:
Serialized Form

Field Summary
static java.lang.String COPYRIGHT
          Copyright
 
Constructor Summary
TWSException(java.lang.String currentCatalog, java.lang.String currentMessageID)
          Creates a TWSException with the specified message
TWSException(java.lang.String currentCatalog, java.lang.String currentMessageID, java.lang.Object[] currentArgs)
          Creates a TWSException with the specified message and arguments
TWSException(java.lang.String currentCatalog, java.lang.String currentMessageID, java.lang.Object[] currentArgs, java.lang.Throwable cause)
          Creates a TWSException with the specified message, arguments and root cause
TWSException(java.lang.String currentCatalog, java.lang.String currentMessageID, java.lang.Throwable cause)
          Creates a TWSException with the specified message and root cause
TWSException(java.lang.Throwable cause)
          Creates a TWSException with the specified root cause
 
Method Summary
protected  java.lang.Object[] getArgs(java.util.Locale locale)
          Returns the arguments to be used when formatting messages in the given locale.
protected  java.lang.String getCauseMessage(java.util.Locale locale)
          Returns the message of the root cause, if any, and is called during message formatting.
 java.lang.String getLocalizedMessage()
          Returns the default locale message string of this TWSException
 java.lang.String getLocalizedMessage(java.util.Locale locale)
          Returns a localized message string of this TWSException
 java.lang.String getMessage()
          Returns the english message string of this TWSException
protected  void initialize(java.lang.String currentCatalog, java.lang.String currentMessageID, java.lang.Object[] currentArgs, java.lang.Throwable cause)
          Initializes instance fields of this TWSException
 void printStackTrace()
          Prints the stack trace to System.err
 void printStackTrace(java.io.PrintStream out)
          Prints the stack trace to the specified PrintStream
 void printStackTrace(java.io.PrintWriter out)
          Prints the stack trace to the specified PrintWriter
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getStackTrace, initCause, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
Copyright

Constructor Detail

TWSException

public TWSException(java.lang.Throwable cause)
Creates a TWSException with the specified root cause

Parameters:
cause - The exception that has caused the problem (its message is added as the last argument)

TWSException

public TWSException(java.lang.String currentCatalog,
                    java.lang.String currentMessageID)
Creates a TWSException with the specified message

Parameters:
currentCatalog - The messages resource bundle name
currentMessageID - The message key in the resource bundle

TWSException

public TWSException(java.lang.String currentCatalog,
                    java.lang.String currentMessageID,
                    java.lang.Throwable cause)
Creates a TWSException with the specified message and root cause

Parameters:
currentCatalog - The messages resource bundle name
currentMessageID - The message key in the resource
cause - The exception that has caused the problem (its message is added as the last argument)

TWSException

public TWSException(java.lang.String currentCatalog,
                    java.lang.String currentMessageID,
                    java.lang.Object[] currentArgs)
Creates a TWSException with the specified message and arguments

Parameters:
currentCatalog - The messages resource bundle name
currentMessageID - The message key in the resource bundle
currentArgs - The arguments of the message

TWSException

public TWSException(java.lang.String currentCatalog,
                    java.lang.String currentMessageID,
                    java.lang.Object[] currentArgs,
                    java.lang.Throwable cause)
Creates a TWSException with the specified message, arguments and root cause

Parameters:
currentCatalog - The messages resource bundle name
currentMessageID - The message key in the resource bundle
currentArgs - The arguments of the message
cause - The exception that has caused the problem (its message is added as the last argument)
Method Detail

getMessage

public java.lang.String getMessage()
Returns the english message string of this TWSException

Returns:
The message string of this TWSException, formatted with the english locale

getLocalizedMessage

public java.lang.String getLocalizedMessage()
Returns the default locale message string of this TWSException

Returns:
The message string of this TWSException, formatted with the default locale

getLocalizedMessage

public java.lang.String getLocalizedMessage(java.util.Locale locale)
Returns a localized message string of this TWSException

Parameters:
locale - The locale to be used for the message
Returns:
The message string of this TWSException, formatted with the specified locale

printStackTrace

public void printStackTrace()
Prints the stack trace to System.err


printStackTrace

public void printStackTrace(java.io.PrintStream out)
Prints the stack trace to the specified PrintStream

Parameters:
out - The output print stream to be used

printStackTrace

public void printStackTrace(java.io.PrintWriter out)
Prints the stack trace to the specified PrintWriter

Parameters:
out - The output print writer to be used

getArgs

protected java.lang.Object[] getArgs(java.util.Locale locale)
Returns the arguments to be used when formatting messages in the given locale. Override this method to use different arguments for different locales, or if arguments have not been passed to the constructor. The base implementation adds the cause message as last argument, which is obtained using getCauseMessage()

Parameters:
locale - The locale to be used for the message
Returns:
The arguments to be used in message formatting

getCauseMessage

protected java.lang.String getCauseMessage(java.util.Locale locale)
Returns the message of the root cause, if any, and is called during message formatting. Extracts the localized message of the root cause, calling getLocalizedMessage(locale) for TWSException root causes, and getLocalizedMessage() or getMessage() for other ones (respectively if the specified locale is the same as the default one or is different)

Parameters:
locale - The locale to be used for the message
Returns:
The localized root cause message

initialize

protected void initialize(java.lang.String currentCatalog,
                          java.lang.String currentMessageID,
                          java.lang.Object[] currentArgs,
                          java.lang.Throwable cause)
Initializes instance fields of this TWSException

Parameters:
currentCatalog - The messages resource bundle name
currentMessageID - The message key in the resource bundle
currentArgs - The arguments of the message
cause - The exception that has caused the problem (its message is added as the last argument)


Copyright © 2005 IBM All Rights Reserved.