Class NestedExceptionUtils
java.lang.Object
org.springframework.core.NestedExceptionUtils
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.
- Since:
- 2.0
- Author:
- Juergen Hoeller
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbuildMessage(@Nullable String message, @Nullable Throwable cause) Deprecated.as of 6.0, in favor of custom exception messages with selective inclusion of cause messagesstatic ThrowablegetMostSpecificCause(Throwable original) Retrieve the most specific cause of the given exception, that is, either the innermost cause (root cause) or the exception itself.getRootCause(@Nullable Throwable original) Retrieve the innermost cause of the given exception, if any.
- 
Constructor Details- 
NestedExceptionUtilspublic NestedExceptionUtils()
 
- 
- 
Method Details- 
buildMessage@Deprecated(since="6.0") public static @Nullable String buildMessage(@Nullable String message, @Nullable Throwable cause) Deprecated.as of 6.0, in favor of custom exception messages with selective inclusion of cause messagesBuild a message for the given base message and root cause.- Parameters:
- message- the base message
- cause- the root cause
- Returns:
- the full exception message
 
- 
getRootCause
- 
getMostSpecificCauseRetrieve the most specific cause of the given exception, that is, either the innermost cause (root cause) or the exception itself.Differs from getRootCause(Throwable)in that it falls back to the original exception if there is no root cause.- Parameters:
- original- the original exception to introspect
- Returns:
- the most specific cause (never null)
- Since:
- 4.3.9
 
 
-