Class ThrowableHelper


  • public abstract class ThrowableHelper
    extends java.lang.Object
    Helper class for handling throwable objects.
    Author:
    Bruno Dillenseger
    • Constructor Summary

      Constructors 
      Constructor Description
      ThrowableHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getMessages​(java.lang.Throwable ex)
      Recursively gets exception messages and concatenate them.
      static java.lang.String getStackTrace​(java.lang.Throwable ex)
      This method returns a recursive dump of an Throwable object as a simple String
      static java.lang.String[] getStackTraceLines​(java.lang.Throwable ex)
      This method returns a recursive dump of an Throwable object as an array of strings
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ThrowableHelper

        public ThrowableHelper()
    • Method Detail

      • getStackTrace

        public static java.lang.String getStackTrace​(java.lang.Throwable ex)
        This method returns a recursive dump of an Throwable object as a simple String
        Parameters:
        ex - the throwable object (Exception, Error...)
        Returns:
        the full stack trace as a single String
      • getStackTraceLines

        public static java.lang.String[] getStackTraceLines​(java.lang.Throwable ex)
        This method returns a recursive dump of an Throwable object as an array of strings
        Parameters:
        ex - the throwable object (Exception, Error...)
        Returns:
        the full stack trace as an array of strings containing the stack trace lines
      • getMessages

        public static java.lang.String getMessages​(java.lang.Throwable ex)
        Recursively gets exception messages and concatenate them.
        Parameters:
        ex - the exception to get messages from
        Returns:
        A string consisting of exception messages separated with newlines.