Class WrapperException

  • All Implemented Interfaces:
    Serializable

    public class WrapperException
    extends RuntimeException
    A WrapperException wraps a Throwable object as a RuntimeException.
    Author:
    cp 2000.08.03
    See Also:
    CheckedWrapperException, Serialized Form
    • Constructor Detail

      • WrapperException

        public WrapperException​(Throwable e,
                                String s)
        Construct a WrapperException from a Throwable object and an additional description.
        Parameters:
        e - the Throwable object
        s - the additional description
      • WrapperException

        public WrapperException​(Throwable e)
        Construct a WrapperException from a Throwable object.
        Parameters:
        e - the Throwable object
      • WrapperException

        public WrapperException​(String s)
        Construct a WrapperException with a specified detail message.
        Parameters:
        s - the String that contains a detailed message
    • Method Detail

      • ensure

        public static WrapperException ensure​(Throwable e,
                                              String s)
        Ensure a WrapperException from a Throwable object and an additional description.
        Parameters:
        e - the Throwable object
        s - the additional description
        Returns:
        a new instance of a WrapperException with a specified message and cause, unless the specified cause is already an instance of a WrapperException with the same message, in which case the specified throwable is returned
      • ensure

        public static WrapperException ensure​(Throwable e)
        Ensure a WrapperException from a Throwable object.
        Parameters:
        e - the Throwable object
        Returns:
        a new instance of a WrapperException with a specified cause, unless the specified Throwable is already an instance of a WrapperException, in which case the specified throwable is returned
      • getOriginalException

        public Throwable getOriginalException()
        Returns:
        the original (wrapped) exception.
      • getRootCause

        public Throwable getRootCause()
        Return the root cause of this exception.
        Returns:
        the root cause of exception.
      • getWrapper

        public String getWrapper()
        Returns:
        a String that shows the original exception was wrapped
      • getMessage

        public String getMessage()
        Returns the error message string of this WrapperException object.
        Overrides:
        getMessage in class Throwable
        Returns:
        the error message string of this WrapperException
      • getLocalizedMessage

        public String getLocalizedMessage()
        Creates a localized description of this WrapperException. Subclasses may override this method in order to produce a locale-specific message. For subclasses that do not override this method, the default implementation returns the same result as getMessage().
        Overrides:
        getLocalizedMessage in class Throwable
        Returns:
        The localized description of this WrapperException.
      • toString

        public String toString()
        Returns a short description of this WrapperException object.
        Overrides:
        toString in class Throwable
        Returns:
        a string representation of this WrapperException.