java.lang.Object | |
↳ | org.springframework.security.web.util.ThrowableAnalyzer |
Handler for analyzing Throwable instances. Can be subclassed to customize its behavior.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
DEFAULT_EXTRACTOR | Default extractor for Throwable instances. |
||||||||||
INVOCATIONTARGET_EXTRACTOR | Default extractor for InvocationTargetException instances. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new
ThrowableAnalyzer instance. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Determines the cause chain of the provided
Throwable . | |||||||||||
Returns the first throwable from the passed in array that is assignable to the provided type.
| |||||||||||
Verifies that the provided throwable is a valid subclass of the provided type (or of the type itself).
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Initializes associations between
Throwable s and ThrowableCauseExtractor s. | |||||||||||
Registers a
ThrowableCauseExtractor for the specified type. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Default extractor for Throwable
instances.
Default extractor for InvocationTargetException instances.
Creates a new ThrowableAnalyzer
instance.
Determines the cause chain of the provided Throwable
.
The returned array contains all throwables extracted from the stacktrace, using the registered
extractors
. The elements of the array are ordered:
The first element is the passed in throwable itself. The following elements
appear in their order downward the stacktrace.
Note: If no ThrowableCauseExtractor
is registered for this instance
then the returned array will always only contain the passed in throwable.
throwable | the Throwable to analyze |
---|
IllegalArgumentException | if the throwable is null |
---|
Returns the first throwable from the passed in array that is assignable to the provided type. A returned instance is safe to be cast to the specified type.
If the passed in array is null or empty this method returns null
.
throwableType | the type to look for |
---|---|
chain | the array (will be processed in element order) |
Throwable
, null
if not foundIllegalArgumentException | if the provided type is null
or no subclass of Throwable
|
---|
Verifies that the provided throwable is a valid subclass of the provided type (or of the type itself).
If expectdBaseType
is null
, no check will be performed.
Can be used for verification purposes in implementations
of extractors
.
throwable | the Throwable to check |
---|---|
expectedBaseType | the type to check against |
IllegalArgumentException | if throwable is either null
or its type is not assignable to expectedBaseType
|
---|
Initializes associations between Throwable
s and ThrowableCauseExtractor
s.
The default implementation performs the following registrations:
DEFAULT_EXTRACTOR
for Throwable
INVOCATIONTARGET_EXTRACTOR
for InvocationTargetException
Note: An extractor registered for a specific type is applicable for that type and all subtypes thereof.
However, extractors registered to more specific types are guaranteed to be resolved first.
So in the default case InvocationTargetExceptions will be handled by INVOCATIONTARGET_EXTRACTOR
while all other throwables are handled by DEFAULT_EXTRACTOR
.
Registers a ThrowableCauseExtractor
for the specified type.
Can be used in subclasses overriding initExtractorMap()
.
throwableType | the type (has to be a subclass of Throwable ) |
---|---|
extractor | the associated ThrowableCauseExtractor (not null ) |
IllegalArgumentException | if one of the arguments is invalid |
---|