Guard against null arguments.
This commit is contained in:
parent
a394d7aa0d
commit
9f6a132842
1 changed files with 10 additions and 1 deletions
|
@ -3,6 +3,7 @@
|
||||||
package edu.cornell.mannlib.vitro.webapp.auth.identifier.common;
|
package edu.cornell.mannlib.vitro.webapp.auth.identifier.common;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -14,8 +15,16 @@ import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle;
|
||||||
* CommonIdentifierBundleFactory.
|
* CommonIdentifierBundleFactory.
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractCommonIdentifier {
|
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) {
|
IdentifierBundle ids, Class<T> clazz) {
|
||||||
|
if ((ids == null) || (clazz == null)) {
|
||||||
|
return Collections.emptySet();
|
||||||
|
}
|
||||||
|
|
||||||
Set<T> set = new HashSet<T>();
|
Set<T> set = new HashSet<T>();
|
||||||
for (Identifier id : ids) {
|
for (Identifier id : ids) {
|
||||||
if (clazz.isAssignableFrom(id.getClass())) {
|
if (clazz.isAssignableFrom(id.getClass())) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue