org.xins.logdoc
Class ExceptionUtils

java.lang.Object
  extended byorg.xins.logdoc.ExceptionUtils

public final class ExceptionUtils
extends Object

Utility functions related to exceptions.

Since:
XINS 1.2.0
Version:
$Revision: 1.8 $ $Date: 2006/08/28 09:12:30 $
Author:
Ernst de Haan

Method Summary
static Throwable getCause(Throwable exception)
          Determines the cause for the specified exception.
static Throwable getRootCause(Throwable exception)
          Determines the root cause for the specified exception.
static void setCause(Throwable exception, Throwable cause)
          Sets the cause for the specified exception.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getRootCause

public static Throwable getRootCause(Throwable exception)
                              throws IllegalArgumentException
Determines the root cause for the specified exception.

Parameters:
exception - the exception to determine the root cause for, cannot be null.
Returns:
the root cause exception, never null.
Throws:
IllegalArgumentException - if exception == null.

getCause

public static Throwable getCause(Throwable exception)
                          throws IllegalArgumentException
Determines the cause for the specified exception.

Parameters:
exception - the exception to determine the cause for, cannot be null.
Returns:
the cause exception, never null.
Throws:
IllegalArgumentException - if exception == null.

setCause

public static void setCause(Throwable exception,
                            Throwable cause)
                     throws IllegalArgumentException,
                            IllegalStateException
Sets the cause for the specified exception.

Parameters:
exception - the exception to set the cause for, cannot be null.
cause - the cause exception, can be null but cannot be the same as exception.
Throws:
IllegalArgumentException - if exception == null || exception == cause.
IllegalStateException - if the cause exception was already set.


See http://www.xins.org/.