web/src/main/java/org/springframework/security/web/util/ThrowableAnalyzer.java
public final Throwable[] determineCauseChain(Throwable throwable) {
		if (throwable == null) {
			throw new IllegalArgumentException("Invalid throwable: null");
		}

		List<Throwable> chain = new ArrayList<>();
		Throwable currentThrowable = throwable;

		while (currentThrowable != null) {
			chain.add(currentThrowable);
			currentThrowable = extractCause(currentThrowable);
		}

		return chain.toArray(new Throwable[chain.size()]);
	}
public final Throwable[] determineCauseChain(Throwable throwable) {
		if (throwable == null) {
			throw new IllegalArgumentException("Invalid throwable: null");
		}

		List<Throwable> chain = new ArrayList<>();
		Throwable currentThrowable = throwable;

		while (currentThrowable != null) {
			chain.add(currentThrowable);
			currentThrowable = extractCause(currentThrowable);
		}

		return chain.toArray(new Throwable[chain.size()]);
	}
Determines the cause chain of the provided <code>Throwable</code>. The returned
array contains all throwables extracted from the stacktrace, using the registered
{@link ThrowableCauseExtractor 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.
<p>
Note: If no {@link ThrowableCauseExtractor} is registered for this instance then
the returned array will always only contain the passed in throwable.

@param throwable the <code>Throwable</code> to analyze
@return an array of all determined throwables from the stacktrace

@throws IllegalArgumentException if the throwable is <code>null</code>

@see #initExtractorMap()