Class UncheckedException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.postgresql.pljava.internal.UncheckedException
All Implemented Interfaces:
Serializable

public final class UncheckedException extends RuntimeException
An unchecked exception to efficiently wrap checked Throwables.

This exception does not carry a message or stack trace of its own; most of its methods proxy through to those of its 'cause', so that it does not appear as an extra layer of indirection in a typical stack trace. It has one specific new method, unwrap, to obtain the actual wrapped throwable (as getCause is proxied to return the wrapped throwable's cause).

See Also:
  • Method Details

    • unchecked

      public static RuntimeException unchecked(Exception e)
      Return the exception e as a RuntimeException.

      Intended for use in a throw unchecked(e); construct. If e is already an unchecked exception, it is simply returned; otherwise, it is returned wrapped.

      Returns:
      the supplied exception, possibly wrapped
    • unchecked

      public static RuntimeException unchecked(Throwable t)
      Return the throwable t as a RuntimeException.

      Intended for use in a throw unchecked(t); construct. If t is already a RuntimeException, it is simply returned; if it is an Error, it is thrown from this method; otherwise, it is returned wrapped.

      Returns:
      the supplied exception, possibly wrapped
      Throws:
      Error - or a subclass, if that's what t is
    • unwrap

      public Throwable unwrap()
      Return the Throwable that this UncheckedException wraps.

      The familiar inherited methods proxy through to the wrapped throwable (so getCause will return its cause, and so on); this distinct method is provided to undo the wrapping.

      Returns:
      the wrapped Throwable
    • fillInStackTrace

      public Throwable fillInStackTrace()
      Overrides:
      fillInStackTrace in class Throwable
    • getCause

      public Throwable getCause()
      Overrides:
      getCause in class Throwable
    • getLocalizedMessage

      public String getLocalizedMessage()
      Overrides:
      getLocalizedMessage in class Throwable
    • getMessage

      public String getMessage()
      Overrides:
      getMessage in class Throwable
    • getStackTrace

      public StackTraceElement[] getStackTrace()
      Overrides:
      getStackTrace in class Throwable
    • initCause

      public Throwable initCause(Throwable cause)
      Overrides:
      initCause in class Throwable
    • printStackTrace

      public void printStackTrace()
      Overrides:
      printStackTrace in class Throwable
    • printStackTrace

      public void printStackTrace(PrintStream s)
      Overrides:
      printStackTrace in class Throwable
    • printStackTrace

      public void printStackTrace(PrintWriter s)
      Overrides:
      printStackTrace in class Throwable
    • setStackTrace

      public void setStackTrace(StackTraceElement[] stackTrace)
      Overrides:
      setStackTrace in class Throwable
    • toString

      public String toString()
      Overrides:
      toString in class Throwable