Package jodd.exception
Class UncheckedException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- jodd.exception.UncheckedException
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
BeanException,TypeConversionException
public class UncheckedException extends java.lang.RuntimeExceptionUnchecked exception and also a wrapper for checked exceptions.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceUncheckedException.CallableVoid
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Throwablecauseprotected static java.lang.StringCAUSE_DIVDivider between causes printouts.protected booleanshowCauseDetailsIf set totruestack trace will be enhanced with cause's stack traces.
-
Constructor Summary
Constructors Constructor Description UncheckedException()UncheckedException(java.lang.String message)UncheckedException(java.lang.String message, java.lang.Throwable t)UncheckedException(java.lang.String message, java.lang.Throwable t, boolean showCauseDetails)UncheckedException(java.lang.Throwable t)UncheckedException(java.lang.Throwable t, boolean showCauseDetails)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <V> VcallAndWrapException(java.util.concurrent.Callable<V> callable)Wraps checked exceptions in aUncheckedException.java.lang.ThrowablegetCause()Returns exception cause.java.lang.StringgetMessage()Returns the detail message, including the message from the nested exception if there is one.voidprintStackTrace()voidprintStackTrace(java.io.PrintStream ps)voidprintStackTrace(java.io.PrintWriter pw)voidrethrow()Re-throws cause if exists.static voidrunAndWrapException(UncheckedException.CallableVoid callable)Wraps checked exceptions in aUncheckedException.static java.lang.RuntimeExceptionwrap(java.lang.Throwable t)Wraps all exceptions in aUncheckedExceptionstatic java.lang.RuntimeExceptionwrap(java.lang.Throwable t, java.lang.String message)Wraps all exceptions in aUncheckedException
-
-
-
Field Detail
-
cause
protected final java.lang.Throwable cause
-
CAUSE_DIV
protected static final java.lang.String CAUSE_DIV
Divider between causes printouts.- See Also:
- Constant Field Values
-
showCauseDetails
protected final boolean showCauseDetails
If set totruestack trace will be enhanced with cause's stack traces.
-
-
Constructor Detail
-
UncheckedException
public UncheckedException(java.lang.Throwable t)
-
UncheckedException
public UncheckedException(java.lang.Throwable t, boolean showCauseDetails)
-
UncheckedException
public UncheckedException()
-
UncheckedException
public UncheckedException(java.lang.String message)
-
UncheckedException
public UncheckedException(java.lang.String message, java.lang.Throwable t)
-
UncheckedException
public UncheckedException(java.lang.String message, java.lang.Throwable t, boolean showCauseDetails)
-
-
Method Detail
-
printStackTrace
public void printStackTrace()
- Overrides:
printStackTracein classjava.lang.Throwable
-
printStackTrace
public void printStackTrace(java.io.PrintStream ps)
- Overrides:
printStackTracein classjava.lang.Throwable
-
printStackTrace
public void printStackTrace(java.io.PrintWriter pw)
- Overrides:
printStackTracein classjava.lang.Throwable
-
getMessage
public java.lang.String getMessage()
Returns the detail message, including the message from the nested exception if there is one.- Overrides:
getMessagein classjava.lang.Throwable
-
callAndWrapException
public static <V> V callAndWrapException(java.util.concurrent.Callable<V> callable)
Wraps checked exceptions in aUncheckedException. Unchecked exceptions are not wrapped.
-
runAndWrapException
public static void runAndWrapException(UncheckedException.CallableVoid callable)
Wraps checked exceptions in aUncheckedException. Unchecked exceptions are not wrapped.
-
wrap
public static java.lang.RuntimeException wrap(java.lang.Throwable t)
Wraps all exceptions in aUncheckedException
-
wrap
public static java.lang.RuntimeException wrap(java.lang.Throwable t, java.lang.String message)Wraps all exceptions in aUncheckedException
-
rethrow
public void rethrow() throws java.lang.ThrowableRe-throws cause if exists.- Throws:
java.lang.Throwable
-
getCause
public java.lang.Throwable getCause()
Returns exception cause.- Overrides:
getCausein classjava.lang.Throwable
-
-