Class ExceptionUtils


  • public class ExceptionUtils
    extends Object
    Copied from apache.commons.lang3 3.7
    • Field Detail

      • EMPTY_STRING_ARRAY

        public static final String[] EMPTY_STRING_ARRAY
        Copied from apache.commons.lang3 3.7 ArrayUtils class

        An empty immutable String array.

    • Constructor Detail

      • ExceptionUtils

        public ExceptionUtils()
    • Method Detail

      • getStackTrace

        public static String getStackTrace​(Throwable throwable)
        Gets the stack trace from a Throwable as a String.

        The result of this method vary by JDK version as this method uses Throwable.printStackTrace(java.io.PrintWriter). On JDK1.3 and earlier, the cause exception will not be shown unless the specified throwable alters printStackTrace.

        Parameters:
        throwable - the Throwable to be examined
        Returns:
        the stack trace as generated by the exception's printStackTrace(PrintWriter) method
      • getStackFrames

        public static String[] getStackFrames​(Throwable throwable)
        Captures the stack trace associated with the specified Throwable object, decomposing it into a list of stack frames.

        The result of this method vary by JDK version as this method uses Throwable.printStackTrace(java.io.PrintWriter). On JDK1.3 and earlier, the cause exception will not be shown unless the specified throwable alters printStackTrace.

        Parameters:
        throwable - the Throwable to examine, may be null
        Returns:
        an array of strings describing each stack frame, never null