Package org.apache.sshd.common.util
Class ExceptionUtils
java.lang.Object
org.apache.sshd.common.util.ExceptionUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Throwable>
TaccumulateException
(T current, T extra) Used to "accumulate" exceptions of the same type.static Throwable
Attempts to get to the "effective" exception being thrown, by taking care of some known exceptions that wrap the original thrown one.static Throwable
static void
static RuntimeException
static RuntimeException
toRuntimeException
(Throwable t, boolean peelThrowable) Converts a thrown generic exception to aRuntimeException
-
Constructor Details
-
ExceptionUtils
private ExceptionUtils()
-
-
Method Details
-
rethrowAsIoException
- Throws:
IOException
-
accumulateException
Used to "accumulate" exceptions of the same type. If the current exception isnull
then the new one becomes the current, otherwise the new one is added as a suppressed exception to the current one- Type Parameters:
T
- The exception type- Parameters:
current
- The current exceptionextra
- The extra/new exception- Returns:
- The resolved exception
- See Also:
-
resolveExceptionCause
- Parameters:
t
- The originalThrowable
- ignored ifnull
- Returns:
- If
Throwable.getCause()
is non-null
then the cause, otherwise the original exception -null
if the original exception wasnull
-
peelException
Attempts to get to the "effective" exception being thrown, by taking care of some known exceptions that wrap the original thrown one.- Parameters:
t
- The originalThrowable
- ignored ifnull
- Returns:
- The effective exception - same as input if not a wrapper
-
toRuntimeException
Converts a thrown generic exception to aRuntimeException
- Parameters:
t
- The original thrown exceptionpeelThrowable
- Whether to determine the root cause by "peeling" any enclosing exceptions- Returns:
- The thrown cause if already a runtime exception, otherwise a runtime exception of the resolved exception as its cause
- See Also:
-
toRuntimeException
-