Keel 2.1RC2

org.keel.core.exception
Class NestedException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended byorg.keel.core.exception.NestedException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AuthorizationException, ChartException, ClientException, ContainerException, DomainException, FinderException, ModelException, PersistenceException, QueryException, ReportException, RepositoryException, ScriptException, UserMgrException

public class NestedException
extends java.lang.Exception

Base exception that allows nesting of other exceptions. Most NestedExceptions will be created using one of the custom constructors. Basically, there are three arguments, each of which is optional, that always appear in the same order: 1: the string message for the exception being created 2: the nested exception (or nested throwable, actually) 3: the exception "key" - for internationalization Any of these can be left out or passed as null, as required in the situation.

See Also:
Serialized Form

Field Summary
private  java.lang.StringBuffer addedMessages
           
private  java.lang.StringBuffer addedStacktrace
           
private  java.lang.String errorKey
           
private  java.lang.String nestedExceptionType
           
 
Fields inherited from class java.lang.Exception
 
Fields inherited from class java.lang.Throwable
 
Constructor Summary
NestedException()
          Default constructor
NestedException(java.lang.String s)
          Constructor with a single message, no key
NestedException(java.lang.String s, java.lang.String newErrorKey)
          String message and error key
NestedException(java.lang.String message, java.lang.Throwable newNested)
          Constructor with a message and a nested exception
NestedException(java.lang.String message, java.lang.Throwable newNested, java.lang.String newErrorKey)
          Constructor with a single message and a nested exception with error key
NestedException(java.lang.Throwable newNested)
          Constructor with no message and a nested exception
NestedException(java.lang.Throwable newNested, java.lang.String newErrorKey)
          Constructor with no message and a nested exception, but with an error key
 
Method Summary
 void addToMessage(java.lang.String s)
           
 void addToStack(java.lang.String s)
          Add a specified string to the stack trace of this exception.
 java.lang.String getErrorKey()
          Return the error key if one was supplied
 java.lang.String getMessage()
          Extend getMessage to return the nested message
 java.lang.String getNestedExceptionType()
           
 java.lang.String getStackTraceAsString()
           
private  java.lang.String getStackTraceAsString(java.lang.Throwable t)
           
 void printStackTrace()
          Extend printStackTrace to handle the nested exception correctly.
 void printStackTrace(java.io.PrintStream p)
          Extend printStackTrace to handle the nested Exception
 void printStackTrace(java.io.PrintWriter p)
          Extend printStackTrace to handle the nested Exception
private  void setNested(java.lang.Throwable newNested)
           
 
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

errorKey

private java.lang.String errorKey

addedStacktrace

private java.lang.StringBuffer addedStacktrace

addedMessages

private java.lang.StringBuffer addedMessages

nestedExceptionType

private java.lang.String nestedExceptionType
Constructor Detail

NestedException

public NestedException()
Default constructor


NestedException

public NestedException(java.lang.String s)
Constructor with a single message, no key

Parameters:
s - exception message

NestedException

public NestedException(java.lang.String s,
                       java.lang.String newErrorKey)
String message and error key


NestedException

public NestedException(java.lang.String message,
                       java.lang.Throwable newNested)
Constructor with a message and a nested exception

Parameters:
newNested - The nested item

NestedException

public NestedException(java.lang.String message,
                       java.lang.Throwable newNested,
                       java.lang.String newErrorKey)
Constructor with a single message and a nested exception with error key

Parameters:
newNested - The nested item

NestedException

public NestedException(java.lang.Throwable newNested)
Constructor with no message and a nested exception

Parameters:
newNested - The nested exception

NestedException

public NestedException(java.lang.Throwable newNested,
                       java.lang.String newErrorKey)
Constructor with no message and a nested exception, but with an error key

Parameters:
newNested - The nested exception
Method Detail

addToMessage

public void addToMessage(java.lang.String s)

setNested

private void setNested(java.lang.Throwable newNested)

getNestedExceptionType

public java.lang.String getNestedExceptionType()

getMessage

public java.lang.String getMessage()
Extend getMessage to return the nested message

Returns:
The extended message.

getErrorKey

public java.lang.String getErrorKey()
Return the error key if one was supplied


printStackTrace

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


printStackTrace

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

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

printStackTrace

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

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

addToStack

public void addToStack(java.lang.String s)
Add a specified string to the stack trace of this exception.

Parameters:
s - The string to add: presumably the string representation of another stack trace

getStackTraceAsString

public java.lang.String getStackTraceAsString()

getStackTraceAsString

private java.lang.String getStackTraceAsString(java.lang.Throwable t)

Keel 2.1RC2

Please see keelframework.org for information about new Keel releases.