java.lang.Object
com.aquima.interactions.foundation.exception.TraceTool

public final class TraceTool extends Object
A Utility class helping in outputting stacktraces with support for old jdk1.3 EJB and JSP exceptions. Since they were created without the use of getcause they use a getRootCause method.
Since:
5.0
Author:
F. van der Meer
  • Constructor Details

    • TraceTool

      public TraceTool(Throwable error)
      Constructs a trace tool with a throwable.
      Parameters:
      error - Should never be null
  • Method Details

    • appendTrace

      public StringBuffer appendTrace(StringBuffer buffer)
      Appends the stack trace to the StringBuffer in a similar way of Throwable.printStackTrace. The function tries to look for more rootcauses then only the one defined in Throwable.getCause.
      Parameters:
      buffer - a StringBuffer to append the exception trace to.
      Returns:
      The string buffer that was passed as argument to this method.
    • appendTrace

      public void appendTrace(Writer writer)
      Appends the stack trace to the Writer in a similar way of Throwable.printStackTrace. The function tries to look for more rootcauses then only the one defined in Throwable.getCause.
      Parameters:
      writer - a Writer to append the exception trace to.
    • appendTrace

      public void appendTrace(PrintStream ostream)
      Appends the stack trace to the PrintStream in a similar way of Throwable.printStackTrace. The function tries to look for more rootcauses then only the one defined in Throwable.getCause.
      Parameters:
      ostream - a PrintStream to append the exception trace to.
    • hasCause

      public boolean hasCause()
      This method returns the cause of the error, or null if none is available.
      Returns:
      the cause of the error, or null if none is available.
    • asString

      public String asString()
      Nice convenience method. Note: This method is somewhat inefficient.
      Returns:
      String the string which normally goes to the writer method.