Uploaded image for project: 'Metadata Aggregator'
  1. Metadata Aggregator
  2. MDA-220

EntityFilterStage over-optimises case where designated entity list is empty

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.2
    • Fix Version/s: 0.10.0
    • Component/s: DOM Metadata
    • Labels:
      None

      Description

      The implementation of processEntityDescriptor in EntityFilterList has a short-circuit optimisation when the designated entity ID list is empty:

              if (designatedEntities.isEmpty()) {
                  return false;
              }
      

      Returning false in this way means that the entity being processed should not be filtered out.

      This is the correct behaviour for the case when blacklisting (i.e., when whitelistingEntities = false) as if we are blacklisting nothing then we want to retain everything.

      However, if we are white listing, this is the wrong thing to do; if we are white listing nothing then we are black listing everything, and we should always return true.

      We can fix this by saying return isWhitelistingEntities(); instead (I think!) but another option is probably to remove the "optimisation" here and rely on the subsequent explicit code to do the right thing. We could refactor that other code to pull the test against the set up front, but I'm not sure whether there is such a need for speed here that it's worth obfuscating what is going on.

        Attachments

          Activity

            People

            Assignee:
            ian@iay.org.uk Ian Young
            Reporter:
            ian@iay.org.uk Ian Young
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - Not Specified
                Not Specified
                Logged:
                Time Spent - 1 hour, 25 minutes
                1h 25m