if (e.getValue() instanceof Collection<?> && ((Collection<?>) e.getValue()).isEmpty()) {
// bnoordhuis: don't add the attribute, it causes a org.opensaml.MalformedException
logger.info("Skipping attribute {} because it does not have any values.", e.getKey());
continue;
}
final Attribute attribute = newSamlObject(Attribute.class);
attribute.setAttributeName(e.getKey());
attribute.setAttributeNamespace(VALIDATION_SAML_ATTRIBUTE_NAMESPACE);
if (e.getValue() instanceof Collection<?>) {
final Collection<?> c = (Collection<?>) e.getValue();
for (final Object value : c) {
attribute.getAttributeValues().add(newAttributeValue(value));
}
} else {
attribute.getAttributeValues().add(newAttributeValue(e.getValue()));
}
attrStatement.getAttributes().add(attribute);
}
return attrStatement;