web/src/main/java/org/springframework/security/web/util/ThrowableAnalyzer.java
public static void verifyThrowableHierarchy(Throwable throwable,
			Class<? extends Throwable> expectedBaseType) {
		if (expectedBaseType == null) {
			return;
		}

		if (throwable == null) {
			throw new IllegalArgumentException("Invalid throwable: null");
		}
		Class<? extends Throwable> throwableType = throwable.getClass();

		if (!expectedBaseType.isAssignableFrom(throwableType)) {
			throw new IllegalArgumentException("Invalid type: '"
					+ throwableType.getName() + "'. Has to be a subclass of '"
					+ expectedBaseType.getName() + "'");
		}
	}
public static void verifyThrowableHierarchy(Throwable throwable,
			Class<? extends Throwable> expectedBaseType) {
		if (expectedBaseType == null) {
			return;
		}

		if (throwable == null) {
			throw new IllegalArgumentException("Invalid throwable: null");
		}
		Class<? extends Throwable> throwableType = throwable.getClass();

		if (!expectedBaseType.isAssignableFrom(throwableType)) {
			throw new IllegalArgumentException("Invalid type: '"
					+ throwableType.getName() + "'. Has to be a subclass of '"
					+ expectedBaseType.getName() + "'");
		}
	}
Verifies that the provided throwable is a valid subclass of the provided type (or
of the type itself). If <code>expectdBaseType</code> is <code>null</code>, no check
will be performed.
<p>
Can be used for verification purposes in implementations of
{@link ThrowableCauseExtractor extractors}.

@param throwable the <code>Throwable</code> to check
@param expectedBaseType the type to check against

@throws IllegalArgumentException if <code>throwable</code> is either
<code>null</code> or its type is not assignable to <code>expectedBaseType</code>