Class ExceptionUtils


  • public class ExceptionUtils
    extends java.lang.Object
    Use this to create a new Exception. This will run under JDK 1.3 or greater. However, it running under JDK 1.4 it will set the cause.
    Since:
    1.5
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static boolean causesAllowed  
    • Constructor Summary

      Constructors 
      Constructor Description
      ExceptionUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.RuntimeException createRuntimeException​(java.lang.String message, java.lang.Throwable cause)
      Create a new RuntimeException, setting the cause if possible.
      static java.lang.Throwable createWithCause​(java.lang.Class clazz, java.lang.String message, java.lang.Throwable cause)
      Create a new Exception, setting the cause if possible.
      static void setCause​(java.lang.Throwable onObject, java.lang.Throwable cause)
      Set the cause of the Exception.
      • Methods inherited from class java.lang.Object

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

      • causesAllowed

        private static boolean causesAllowed
    • Constructor Detail

      • ExceptionUtils

        public ExceptionUtils()
    • Method Detail

      • createRuntimeException

        public static java.lang.RuntimeException createRuntimeException​(java.lang.String message,
                                                                        java.lang.Throwable cause)
        Create a new RuntimeException, setting the cause if possible.
        Parameters:
        message -
        cause -
        Returns:
        A runtime exception object.
      • createWithCause

        public static java.lang.Throwable createWithCause​(java.lang.Class clazz,
                                                          java.lang.String message,
                                                          java.lang.Throwable cause)
        Create a new Exception, setting the cause if possible.
        Parameters:
        clazz -
        message -
        cause -
        Returns:
        A Throwable.
      • setCause

        public static void setCause​(java.lang.Throwable onObject,
                                    java.lang.Throwable cause)
        Set the cause of the Exception. Will detect if this is not allowed.
        Parameters:
        onObject -
        cause -