raccoon.api.exception
Class RaccoonException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by raccoon.api.exception.RaccoonException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
IntrospectionException, LoadableException, ResourceNotFoundException, ServiceException

public class RaccoonException
extends java.lang.Exception

The base exception for all Raccoon exception, all exceptions inherit from this exception.

Since:
Raccoon v0.1, refactored in Raccoon v0.3, v0.5 and v0.8
Version:
$Id: RaccoonException.java,v 1.1 2004/08/08 20:25:57 crouvrais Exp $
Author:
Cedric ROUVRAIS
See Also:
Serialized Form

Field Summary
static int MAX_MESSAGE_LENGTH
          The maximum line length of a message.
static int MAX_MSG_SIZE
          The maximum number of characters for given line.
static int MAX_STACK_DEPTH
          The number of stacks of the contained exceptions printed out in the toString method.
static java.lang.String MESSAGE_TOO_LONG
          A string indicating a too long message to display.
 
Constructor Summary
RaccoonException()
          Constructs a RaccoonException with no specified detail message.
RaccoonException(int pErrorCode, java.lang.String pMessage)
          Contructs a RaccoonException with the specified error code and detail message.
RaccoonException(int pErrorCode, java.lang.String pMessage, java.lang.Throwable pThrowable)
          Constructs a RaccoonException with the specified error code, detail message and nested exception.
RaccoonException(java.lang.String pMessage)
          Constructs a RaccoonException with the specified detail message.
RaccoonException(java.lang.String pMessage, java.lang.Throwable pThrowable)
          Constructs a RaccoonException with the specified detail message and nested exception.
 
Method Summary
 void addContainedException(java.lang.Throwable pThrowable)
          Adds an exception to this instance, useful when more than one nested exception is required.
static java.lang.String buildString(java.lang.Throwable pThrowable, java.lang.String pOffSet)
          Generates a string containing the stacktrace of the throwable.
 java.lang.Throwable getContainedException(int pPosition)
          Retrieves the element from the collection containedExceptions at the specified index.
 java.util.ArrayList getContainedExceptions()
          All the exceptions carried by this instance.
 int getContainedExceptionsSize()
          Retrieves the number of elements within the collection containedExceptions.
 int getErrorCode()
          Convenience method for retrieving the component error code of this instance.
 java.lang.String getErrorMessage()
          Use this method to retrieve the error carried by this instance and not all the error messages.
 java.lang.String getMessage()
          Returns the detail message, including the message from the nested exception if there is one.
 java.util.Iterator iterContainedExceptions()
          Iterator on the elements within the collection containedExceptions.
 java.lang.String printStackTraceAsString()
          Generates a String representation of the StackTrace.
 void setContainedException(int pPosition, java.lang.Throwable pThrowable)
          Defines the element from the collection containedExceptions at the specified index.
 void setContainedExceptions(java.util.ArrayList pContainedExceptions)
          Defines all the exceptions that this instance should carry.
 void setErrorCode(int pErrorCode)
          Defines the error code associated to this instance.
 void setErrorMessage(java.lang.String pErrorMessage)
          Defines the error message associated to this exception, it doesn't impact the nested exceptions.
 java.lang.String toString()
          Returns a short description of this throwable.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_STACK_DEPTH

public static final int MAX_STACK_DEPTH
The number of stacks of the contained exceptions printed out in the toString method.

See Also:
Constant Field Values

MESSAGE_TOO_LONG

public static final java.lang.String MESSAGE_TOO_LONG
A string indicating a too long message to display.

See Also:
Constant Field Values

MAX_MSG_SIZE

public static final int MAX_MSG_SIZE
The maximum number of characters for given line.

See Also:
Constant Field Values

MAX_MESSAGE_LENGTH

public static final int MAX_MESSAGE_LENGTH
The maximum line length of a message.

Constructor Detail

RaccoonException

public RaccoonException()
Constructs a RaccoonException with no specified detail message.


RaccoonException

public RaccoonException(java.lang.String pMessage)
Constructs a RaccoonException with the specified detail message.

Parameters:
pMessage - the detail message

RaccoonException

public RaccoonException(java.lang.String pMessage,
                        java.lang.Throwable pThrowable)
Constructs a RaccoonException with the specified detail message and nested exception.

Parameters:
pMessage - the detail message
pThrowable - the nested exception

RaccoonException

public RaccoonException(int pErrorCode,
                        java.lang.String pMessage)
Contructs a RaccoonException with the specified error code and detail message.

Parameters:
pErrorCode - the error code
pMessage - the detail message

RaccoonException

public RaccoonException(int pErrorCode,
                        java.lang.String pMessage,
                        java.lang.Throwable pThrowable)
Constructs a RaccoonException with the specified error code, detail message and nested exception.

Parameters:
pErrorCode - the error code
pMessage - the detail message
pThrowable - the nested exception
Method Detail

getMessage

public java.lang.String getMessage()
Returns the detail message, including the message from the nested exception if there is one.

Overrides:
getMessage in class java.lang.Throwable
Returns:
the detail message, including nested exception message if any

getErrorMessage

public java.lang.String getErrorMessage()
Use this method to retrieve the error carried by this instance and not all the error messages. This method is useful when handling only the last error message, whereas getMessage returns the full stack trace.

Returns:
the error message carried by this instance.

setErrorMessage

public void setErrorMessage(java.lang.String pErrorMessage)
Defines the error message associated to this exception, it doesn't impact the nested exceptions.
WARNING: Do no call this method, use RaccoonException(String). This method doesn't define error message for inherited class This method is here for internal purposes only!

Parameters:
pErrorMessage - the error message.

printStackTraceAsString

public java.lang.String printStackTraceAsString()
Generates a String representation of the StackTrace. Handy when the you need to get the StackTrace without pushing it to stderr

Returns:
the string representing the stack trace

getErrorCode

public int getErrorCode()
Convenience method for retrieving the component error code of this instance.

Returns:
the error code.

setErrorCode

public void setErrorCode(int pErrorCode)
Defines the error code associated to this instance.

Parameters:
pErrorCode - the error code, a value of ComponentError

getContainedExceptions

public java.util.ArrayList getContainedExceptions()
All the exceptions carried by this instance.

Returns:
vector of Throwable

setContainedExceptions

public void setContainedExceptions(java.util.ArrayList pContainedExceptions)
Defines all the exceptions that this instance should carry.

Parameters:
pContainedExceptions - a vector of Throwable

addContainedException

public void addContainedException(java.lang.Throwable pThrowable)
Adds an exception to this instance, useful when more than one nested exception is required.

Parameters:
pThrowable - the nested exception

getContainedException

public java.lang.Throwable getContainedException(int pPosition)
                                          throws java.lang.ArrayIndexOutOfBoundsException
Retrieves the element from the collection containedExceptions at the specified index.

Parameters:
pPosition - index of the desired element
Returns:
the value of containedExceptions[pIndex]
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the index is negative or not less than the current size of teamMembers

setContainedException

public void setContainedException(int pPosition,
                                  java.lang.Throwable pThrowable)
                           throws java.lang.IndexOutOfBoundsException
Defines the element from the collection containedExceptions at the specified index.

Parameters:
pPosition - index of the desired element
pThrowable - the nested exception
Throws:
java.lang.IndexOutOfBoundsException - if the index is negative or not less than the current size of teamMembers

iterContainedExceptions

public java.util.Iterator iterContainedExceptions()
Iterator on the elements within the collection containedExceptions.

Returns:
the iterator of ContainedExceptions

getContainedExceptionsSize

public int getContainedExceptionsSize()
Retrieves the number of elements within the collection containedExceptions.

Returns:
the size of ContainedExceptions

toString

public java.lang.String toString()
Returns a short description of this throwable. If this Throwable object was created with a non-null detail message string, then the result is the concatenation of three strings: If this Throwable object was created with a null detail message string, then the name of the actual class of this object is returned.

Overrides:
toString in class java.lang.Throwable
Returns:
a string representation of this throwable.

buildString

public static java.lang.String buildString(java.lang.Throwable pThrowable,
                                           java.lang.String pOffSet)
Generates a string containing the stacktrace of the throwable.

Parameters:
pThrowable - the throwable for which the string is required.
pOffSet - the prefix that is to be attached to the final string, allows for indentation.
Returns:
the string.


Copyright null null. All Rights Reserved.