Top Description Fields Constructors Methods
org.springframework.core

public abstract Class NestedCheckedException

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

Handy class for wrapping checked Exceptions with a root cause. This class is abstract to force the programmer to extend the class.

The similarity between this class and the NestedRuntimeException class is unavoidable, as Java forces these two classes to have different superclasses (ah, the inflexibility of concrete inheritance!).

Authors
Rod Johnson, Juergen Hoeller
See Also
getMessage, NestedRuntimeException

Field Summary

Modifier and TypeField and Description
private static final long
serialVersionUID

Hides java.lang.Exception.serialVersionUID.

Use serialVersionUID from Spring 1.2 for interoperability.

Constructor Summary

AccessConstructor and Description
public
NestedCheckedException(String
the detail message
msg
)

Construct a NestedCheckedException with the specified detail message.

public
NestedCheckedException(String
the detail message
msg
,
Throwable
the nested exception
cause
)

Construct a NestedCheckedException with the specified detail message and nested exception.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

whether there is a nested exception of the specified type
contains
(Class<?>
the exception type to look for
exType
)

Check whether this exception contains an exception of the given type: either it is of the given class itself or it contains a nested cause of the given type.

public Throwable

Returns:

the most specific cause (never null)
getMostSpecificCause
()

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

public Throwable

Returns:

the innermost exception, or null if none
getRootCause
()

Retrieve the innermost cause of this exception, if any.

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.Exception.serialVersionUID.

Use serialVersionUID from Spring 1.2 for interoperability.

Constructor Detail

NestedCheckedExceptionback to summary
public NestedCheckedException(String msg)

Construct a NestedCheckedException with the specified detail message.

Parameters
msg:String

the detail message

NestedCheckedExceptionback to summary
public NestedCheckedException(String msg, Throwable cause)

Construct a NestedCheckedException with the specified detail message and nested exception.

Parameters
msg:String

the detail message

cause:Throwable

the nested exception

Method Detail

containsback to summary
public boolean contains(Class<?> exType)

Check whether this exception contains an exception of the given type: either it is of the given class itself or it contains a nested cause of the given type.

Parameters
exType:Class<?>

the exception type to look for

Returns:boolean

whether there is a nested exception of the specified type

getMostSpecificCauseback to summary
public Throwable getMostSpecificCause()

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

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

Returns:Throwable

the most specific cause (never null)

Since
2.0.3
getRootCauseback to summary
public Throwable getRootCause()

Retrieve the innermost cause of this exception, if any.

Returns:Throwable

the innermost exception, or null if none

Annotations
@Nullable