Guard against null arguments.

This commit is contained in:
j2blake 2011-06-22 14:55:22 +00:00
parent a394d7aa0d
commit 9f6a132842

View file

@ -3,6 +3,7 @@
package edu.cornell.mannlib.vitro.webapp.auth.identifier.common;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@ -14,8 +15,16 @@ import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle;
* CommonIdentifierBundleFactory.
*/
public abstract class AbstractCommonIdentifier {
protected static <T> Collection<T> getIdentifiersForClass(
/**
* Get all of the instances of this class of Identifier from this bundle.
*/
protected static <T extends Identifier> Collection<T> getIdentifiersForClass(
IdentifierBundle ids, Class<T> clazz) {
if ((ids == null) || (clazz == null)) {
return Collections.emptySet();
}
Set<T> set = new HashSet<T>();
for (Identifier id : ids) {
if (clazz.isAssignableFrom(id.getClass())) {