Class ExceptionUtils


  • public final class ExceptionUtils
    extends java.lang.Object
    Provides utilities for manipulating and examining Throwable objects.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      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

        clone, equals, finalize, 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.