Class ExceptionToolkit

java.lang.Object
org.openjdk.jmc.common.util.ExceptionToolkit

public class ExceptionToolkit extends Object
Toolkit for working with exceptions.
  • Constructor Details

    • ExceptionToolkit

      public ExceptionToolkit()
  • Method Details

    • toString

      public static String toString(Throwable t)
      Returns a string with the text from Throwable.printStackTrace(). The string will end with a line break.
      Parameters:
      t - Throwable to get the stack trace from
      Returns:
      a string with the stack trace
    • toString

      public static String toString(Throwable t, int maxFrames)
      Returns a string with a text equivalent to Throwable.printStackTrace(), but with a limited number of frames. The string will end with a line break.
      Parameters:
      t - Throwable to get the stack trace from
      maxFrames - The max number of frames to include in the string. If there are more frames in the stack trace, then an ellipsis is added at the end.
      Returns:
      a string with the stack trace