SEC-393: More elegantly deal with setProviders(List) type safety enforcement.

This commit is contained in:
Ben Alex 2006-11-16 02:15:43 +00:00
parent 5e819af782
commit 2984913051

View File

@ -273,17 +273,8 @@ public class ProviderManager extends AbstractAuthenticationManager implements In
Iterator iter = newList.iterator();
while (iter.hasNext()) {
Object currentObject = null;
try {
currentObject = iter.next();
//TODO bad idea, should use assignable from or instance of
AuthenticationProvider attemptToCast = (AuthenticationProvider) currentObject;
} catch (ClassCastException cce) {
throw new IllegalArgumentException("AuthenticationProvider " + currentObject.getClass().getName()
+ " must implement AuthenticationProvider");
}
Object currentObject = iter.next();
Assert.isInstanceOf(AuthenticationProvider.class, currentObject, "Can only provide AuthenticationProvider instances");
}
this.providers = newList;