ch.systemsx.cisd.common.exceptions
Class ExceptionUtils

java.lang.Object
  extended by ch.systemsx.cisd.common.exceptions.ExceptionUtils

public final class ExceptionUtils
extends java.lang.Object

Provides utilities for manipulating and examining Throwable objects.


Method Summary
static java.lang.Exception createMasqueradingExceptionIfNeeded(java.lang.Exception exception, java.util.Collection<java.lang.String> acceptedPackages)
          Analyzes given exception and makes it independent to packages outside the specified collection or java.lang, ch.systemsx.cisd.common.
static java.lang.Throwable getEndOfChain(java.lang.Throwable throwable)
          Returns the last Throwable of a chain of throwables.
static
<T extends java.lang.Throwable>
T
tryGetThrowableOfClass(java.lang.Throwable throwable, java.lang.Class<T> clazz)
          Returns the first found Throwable of given clazz from the exception chain of given throwable.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createMasqueradingExceptionIfNeeded

public static final java.lang.Exception createMasqueradingExceptionIfNeeded(java.lang.Exception exception,
                                                                            java.util.Collection<java.lang.String> acceptedPackages)
Analyzes given exception and makes it independent to packages outside the specified collection or java.lang, ch.systemsx.cisd.common.


tryGetThrowableOfClass

public static final <T extends java.lang.Throwable> T tryGetThrowableOfClass(java.lang.Throwable throwable,
                                                                             java.lang.Class<T> clazz)
Returns the first found Throwable of given clazz from the exception chain of given throwable.


getEndOfChain

public static java.lang.Throwable getEndOfChain(java.lang.Throwable throwable)
Returns the last Throwable of a chain of throwables.