private void fillAttr(
final List<String> values,
final AnyUtils anyUtils,
final PlainSchema schema,
final PlainAttr<?> attr,
final SyncopeClientException invalidValues) {
List<String> valuesProvided = schema.isMultivalue()
? values
: (values.isEmpty()
? Collections.<String>emptyList()
: Collections.singletonList(values.get(0)));
valuesProvided.forEach(value -> {
if (StringUtils.isBlank(value)) {
LOG.debug("Null value for {}, ignoring", schema.getKey());
} else {
try {
attr.add(value, anyUtils);
} catch (InvalidPlainAttrValueException e) {
String valueToPrint = value.length() > 40
? value.substring(0, 20) + "..."
: value;
LOG.warn("Invalid value for attribute " + schema.getKey() + ": " + valueToPrint, e);
invalidValues.getElements().add(schema.getKey() + ": " + valueToPrint + " - " + e.getMessage());
}
}
});
}