Class ExceptionUtil


  • public class ExceptionUtil
    extends Object
    • Constructor Detail

      • ExceptionUtil

        public ExceptionUtil()
    • Method Detail

      • findExceptionInCauseChain

        public static Throwable findExceptionInCauseChain​(Throwable exceptionToSearchIn,
                                                          Class<?> desiredCause)
        Find an exception in the stack of exception causes whose cause matches the desired one. Note that the exception whose cause matches the desired cause is returned, NOT the cause itself.
        Parameters:
        exceptionToSearchIn - the exception to search through
        desiredCause - the cause that should be found in the stack of causes in the exception to search in
        Returns:
        the desired exception, if found, or null otherwise