Class ThrowableUtil


  • public class ThrowableUtil
    extends Object
    Utility class for working with Throwable:s.
    Version:
    2.9
    Author:
    Nicklas
    Last modified
    $Date: 2014-04-23 14:27:51 +0200 (on, 23 apr 2014) $
    • Constructor Detail

      • ThrowableUtil

        public ThrowableUtil()
    • Method Detail

      • stackTraceToString

        public static String stackTraceToString​(Throwable t)
        Convert a stacktrace to a string that is usually printed with the Throwable.printStackTrace() method.
        Parameters:
        t - The throwable
        Returns:
        The string representation of the stack trace
      • stackTraceToImage

        public static BufferedImage stackTraceToImage​(Throwable t,
                                                      int width,
                                                      int height)
        Prints as much of a stacktrace as possible to an image.
        Parameters:
        t - The throwable
        width - The width of the image
        height - The height of the image
        Since:
        2.14