Top Description Constructors Methods
org.springframework.core

public abstract Class NestedExceptionUtils

extends Object
Class Inheritance
Imports
org.springframework.lang.Nullable

Helper class for implementing exception classes which are capable of holding nested exceptions. Necessary because we can't share a base class among different exception types.

Mainly for use within the framework.

Author
Juergen Hoeller
Since
2.0
See Also
NestedRuntimeException, NestedCheckedException

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

the full exception message
buildMessage
(String
the base message
message
,
Throwable
the root cause
cause
)
Deprecated since 6.0. as of 6.0, in favor of custom exception messages with selective inclusion of cause messages

Build a message for the given base message and root cause.

public static Throwable

Returns:

the most specific cause (never null)
getMostSpecificCause
(Throwable
the original exception to introspect
original
)

Retrieve the most specific cause of the given exception, that is, either the innermost cause (root cause) or the exception itself.

public static Throwable

Returns:

the innermost exception, or null if none
getRootCause
(Throwable
the original exception to introspect
original
)

Retrieve the innermost cause of the given exception, if any.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

NestedExceptionUtilsback to summary
public NestedExceptionUtils()

Method Detail

buildMessageback to summary
public static String buildMessage(String message, Throwable cause)

Deprecated

since 6.0.

as of 6.0, in favor of custom exception messages with selective inclusion of cause messages

Build a message for the given base message and root cause.

Parameters
message:String

the base message

cause:Throwable

the root cause

Returns:String

the full exception message

Annotations
@Deprecated
since:6.0
@Nullable
getMostSpecificCauseback to summary
public static Throwable getMostSpecificCause(Throwable original)

Retrieve the most specific cause of the given exception, that is, either the innermost cause (root cause) or the exception itself.

Differs from getRootCause in that it falls back to the original exception if there is no root cause.

Parameters
original:Throwable

the original exception to introspect

Returns:Throwable

the most specific cause (never null)

Since
4.3.9
getRootCauseback to summary
public static Throwable getRootCause(Throwable original)

Retrieve the innermost cause of the given exception, if any.

Parameters
original:Throwable

the original exception to introspect

Returns:Throwable

the innermost exception, or null if none

Annotations
@Nullable
Since
4.3.9