Class ExceptionTools


  • public class ExceptionTools
    extends java.lang.Object
    Tool class for dealing with Exceptions.
    • Constructor Summary

      Constructors 
      Constructor Description
      ExceptionTools()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.io.IOException createIOException​(java.lang.String message, java.lang.Throwable cause)  
      static void fail()
      Simply fail with a RuntimeException.
      static <T> T futureSimpleGet​(java.util.concurrent.Future<T> future)  
      static <T extends java.lang.Number>
      T
      futureSimpleGetNumber​(java.util.concurrent.Future<T> future)  
      static java.lang.Throwable getInChain​(java.lang.Throwable t, java.lang.Class<?> clazz)  
      static java.lang.Throwable getRoot​(java.lang.Throwable t)
      The root cause of t.
      static java.lang.String getStackTraceString​(java.lang.Throwable t)  
      static boolean isInChain​(java.lang.Throwable t, java.lang.Class<?> clazz)  
      static boolean isKnownReason​(java.lang.Throwable t)  
      • Methods inherited from class java.lang.Object

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

      • ExceptionTools

        public ExceptionTools()
    • Method Detail

      • createIOException

        public static java.io.IOException createIOException​(java.lang.String message,
                                                            java.lang.Throwable cause)
      • fail

        public static void fail()
        Simply fail with a RuntimeException.
      • futureSimpleGet

        public static <T> T futureSimpleGet​(java.util.concurrent.Future<T> future)
      • futureSimpleGetNumber

        public static <T extends java.lang.Number> T futureSimpleGetNumber​(java.util.concurrent.Future<T> future)
      • getInChain

        public static java.lang.Throwable getInChain​(java.lang.Throwable t,
                                                     java.lang.Class<?> clazz)
      • getRoot

        public static java.lang.Throwable getRoot​(java.lang.Throwable t)
        The root cause of t.
        Parameters:
        t - A Throwable.
        Returns:
        The most inner cause of t.
      • getStackTraceString

        public static java.lang.String getStackTraceString​(java.lang.Throwable t)
      • isInChain

        public static boolean isInChain​(java.lang.Throwable t,
                                        java.lang.Class<?> clazz)
      • isKnownReason

        public static boolean isKnownReason​(java.lang.Throwable t)