Expresso 5-6

com.jcorporate.expresso.kernel.exception
Class ChainedException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended bycom.jcorporate.expresso.kernel.exception.ChainedException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AuthValidationException, CacheException, ConfigurationException, ControllerException, DBException, ExpressoRuntimeException, HtmlException, LogException, NonHandleableException, ReportException, ServerException, ValidationException

public class ChainedException
extends Exception

Enhanced Exception class to allow Exception chaining. This helps indicate the origin of an exception more clearly than simply passing on the original message Creation date: (4/15/00 5:47:38 PM)

Author:
Michael Nash
See Also:
Serialized Form

Constructor Summary
ChainedException()
          Normal no-args constructor
ChainedException(String s)
          Normal constructor with a single message
ChainedException(String s, int newErrorNumber)
          Specify an error number
ChainedException(String message, Throwable newNested)
          Constructor with a single message and a nested exception
ChainedException(String message, Throwable newNested, int newErrorNumber)
          Constructor with a single message and a nested exception with error number
ChainedException(Throwable newNested)
          Constructor with no message and a nested exception
ChainedException(Throwable newNested, int newErrorNumber)
          Constructor with no message and a nested exception, but with an error number
 
Method Summary
 int getErrorNumber()
          Return the error number if one was supplied
 String getMessage()
          Extend getMessage to return the nested message (if any) if we don't have one
 Throwable getNested()
          Retrieve the nested exception
static String omitPackages(Object obj)
          utility to get just name of class
 void printStackTrace()
          Extend printStackTrace to handle the nested exception correctly.
 void printStackTrace(PrintStream p)
          Extend printStackTrace to handle the nested Exception
 void printStackTrace(PrintWriter p)
          Extend printStackTrace to handle the nested Exception
 
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
 

Constructor Detail

ChainedException

public ChainedException()
Normal no-args constructor


ChainedException

public ChainedException(String s)
Normal constructor with a single message

Parameters:
s - The exception message

ChainedException

public ChainedException(String s,
                        int newErrorNumber)
Specify an error number

Parameters:
s - the message
newErrorNumber - The error number to assign

ChainedException

public ChainedException(String message,
                        Throwable newNested)
Constructor with a single message and a nested exception

Parameters:
message - The exception message
newNested - The nested item

ChainedException

public ChainedException(String message,
                        Throwable newNested,
                        int newErrorNumber)
Constructor with a single message and a nested exception with error number

Parameters:
message - The exception message
newNested - The nested item
newErrorNumber - the error number associated with the exception

ChainedException

public ChainedException(Throwable newNested)
Constructor with no message and a nested exception

Parameters:
newNested - The nested exception

ChainedException

public ChainedException(Throwable newNested,
                        int newErrorNumber)
Constructor with no message and a nested exception, but with an error number

Parameters:
newNested - The nested exception
newErrorNumber - the error number associated with the exception message
Method Detail

getMessage

public String getMessage()
Extend getMessage to return the nested message (if any) if we don't have one

Returns:
java.lang.String

omitPackages

public static String omitPackages(Object obj)
utility to get just name of class

Parameters:
obj - the object of the given class, the name of which will be returned
Returns:
name of class, less any package prefix

getErrorNumber

public int getErrorNumber()
Return the error number if one was supplied

Returns:
integer: the error number specified (or zero if non was specified)

printStackTrace

public void printStackTrace()
Extend printStackTrace to handle the nested exception correctly.


printStackTrace

public void printStackTrace(PrintStream p)
Extend printStackTrace to handle the nested Exception

Parameters:
p - The PrintStream to write the exception messages into

printStackTrace

public void printStackTrace(PrintWriter p)
Extend printStackTrace to handle the nested Exception

Parameters:
p - The PrintWriter to write the exception messages into

getNested

public Throwable getNested()
Retrieve the nested exception

Returns:
the nested Exception

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.