Class ExceptionUtil


  • public final class ExceptionUtil
    extends Object
    Useful utilities for Exceptions
    • Method Detail

      • getStackTrace

        public static String getStackTrace()
      • isAcceptableOverTheWire

        public static boolean isAcceptableOverTheWire​(Throwable t)
      • getCauses

        public static Throwable[] getCauses​(Throwable start)
        Get the chain of exceptions via getCause(). The first element is the Exception passed.
        Parameters:
        start - the Exception to traverse
        Returns:
        a Throwable[] or an Exception[] as appropriate
      • getRootCause

        public static Throwable getRootCause​(Throwable e)
        Get the original troublemaker.
        Parameters:
        e - the Exception to dig into
        Returns:
        the original Throwable that started the problem
      • getStackTrace

        public static String getStackTrace​(Throwable t)
        Get the stack trace as a String.
        Parameters:
        t - the Throwable whose stack trace should be gotten
        Returns:
        a String containing the stack trace