Option to strip empty/null values on AttributeDefinition output

Description

When using the SimpleAttributePredicate with a wildcard match, NULL attributes that get mapped as EmptyAttributeValue(s) erroneously return true. Wildcard testing on an attribute of EmptyAttributeValue should return false.

The following bean was used for testing this conditions:

The following log line demonstrates that the mail attribute (a SQL NULL value in the connected data store for the test individual) is pulled from the connector as an EmptyAttrbuteValue:

Later, the predicate logs the following:

This seems to be because the hasMatch method of the SimpleAttributePredicate, line 97, loops through all available attributes in the context without checking for EmptyAttributeValues, and calls findMatch.

Later, in the findMatch method, lines 122 - 124, if the toMatch parameter is the wildcard character ("*"), it returns true without inspecting the attribute value to check for EmptyAttributeValues.

I've tagged this as AttributeMapper and AttributeResolver, neither of which seems like an exact match (since predicates and activation conditions weren't available), so feel free to re-categorize as is appropriate.

Environment

None

Activity

Show:

Rod WiddowsonApril 17, 2018 at 3:23 PM

Documentation complete

Rod WiddowsonApril 17, 2018 at 3:15 PM

Work complete and pushed.  Documentation pending

Rod WiddowsonApril 17, 2018 at 1:05 PM

It's theoretical only. We make sure that the Collection<IdPAttributeValue<?>> that we pass never has nulls in it (by construction) but the code in IdPAttribute still does a filter.

{{ ImmutableList.copyOf(Collections2.filter(newValues, Predicates.notNull()));}}

I just replaced it with a Tranfsform
ImmutableList.copyOf(Collections2.transform(newValues, convertNullValues));

Scott CantorApril 17, 2018 at 12:59 PM

If it were stripping by default that would be breaking SQL results. I must be missing something, that was a bug I thought we fixed.

Rod WiddowsonApril 17, 2018 at 9:08 AM
Edited

Nit which I'll fix as I go by

  • IdPAttribute#setValues() silently strips null out from the provided collection

Nits which can stay as is, but need captured for V4 (in )

  • A Scoped Attribute with a null scope is not null.  A Scoped Attribute with a null string is null (regardless of scope)

  • (I'm sure we know this).  The whole Attribute API is in terms of Collections when it should be in terms of lists.  We should probably add a warning if the type isn't a list.

 

Fixed

Details

Assignee

Reporter

Fix versions

Created August 10, 2017 at 3:50 PM
Updated October 10, 2018 at 2:01 PM
Resolved April 17, 2018 at 3:23 PM