[JIRA] (IDP-1735) Filter matchAny function changes value order
Rod Widdowson (Jira)
jira at shibboleth.atlassian.net
Tue Aug 23 12:49:03 UTC 2022
Rod Widdowson ( https://shibboleth.atlassian.net/secure/ViewProfile.jspa?accountId=59fb32bbc24efb3c4ed3c977 ) *commented* on IDP-1735 ( https://shibboleth.atlassian.net/browse/IDP-1735?atlOrigin=eyJpIjoiMjUxZTc3MWZiZDFhNDM2MWEwMzQ1MTdmNWE4OGRhYWMiLCJwIjoiaiJ9 )
Re: Filter matchAny function changes value order ( https://shibboleth.atlassian.net/browse/IDP-1735?atlOrigin=eyJpIjoiMjUxZTc3MWZiZDFhNDM2MWEwMzQ1MTdmNWE4OGRhYWMiLCJwIjoiaiJ9 )
Having done al; this work to make the filters work with lists and not sets, which always felt a wee bit odd given that filtering is more set-like, I suddenly had an inspiration that this bug should have little to do with the order from filtering. the code in AttributeFilterImpl goes
filteredAttributeValues = getFilteredValues(attributeId, filterContext);
filteredAttribute = prefilteredAttributes.get(attributeId).clone();
filteredAttribute.setValues(List.copyOf(filteredAttributeValues));
Which is to say “clone the attribute and overwrite the values with the result of filtering”.
What is *should* is “clone the attribute and remove from it all values which did not get past the fltering, so
filteredAttributeValues = getFilteredValues(attributeId, filterContext);
filteredAttribute = prefilteredAttributes.get(attributeId).clone();
filteredAttribute.retainAll(filteredAttributeValues);
Except of course that we his immutability so it becomes
filteredAttribute = prefilteredAttributes.get(attributeId).clone();
filteredAttributeValues = List.copyOf(filteredAttribute.getValues());
filteredAttributeValues.retainAll(getFilteredValues(attributeId, filterContext);
filteredAttribute.setValues(filteredAttributeValues);
I’ll save what I have done to date into a branch and try this out.
( https://shibboleth.atlassian.net/browse/IDP-1735#add-comment?atlOrigin=eyJpIjoiMjUxZTc3MWZiZDFhNDM2MWEwMzQ1MTdmNWE4OGRhYWMiLCJwIjoiaiJ9 ) Add Comment ( https://shibboleth.atlassian.net/browse/IDP-1735#add-comment?atlOrigin=eyJpIjoiMjUxZTc3MWZiZDFhNDM2MWEwMzQ1MTdmNWE4OGRhYWMiLCJwIjoiaiJ9 )
Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100205- sha1:4a5192e )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/commits/attachments/20220823/4dc3776b/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-static-comment-icon-a9bfc868-fc66-48c0-8fc3-3510addf434b
Type: image/png
Size: 1084 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20220823/4dc3776b/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-avatar-68ddc598-63e2-4b9c-b57a-f311ec19afac
Type: image/png
Size: 425 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20220823/4dc3776b/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-static-footer-desktop-logo-571181f9-dd4d-47b5-aed6-96b9ed8f83c7
Type: image/png
Size: 10805 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20220823/4dc3776b/attachment-0005.png>
More information about the commits
mailing list