Uploaded image for project: 'XNAT'
  1. XNAT
  2. XNAT-6915

XftItemEventCriteria doesn't consider multi-item events when matching

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.8.3
    • 1.8.4
    • XFT
    • None
    • XNAT 2021-Q4 Sprint 2
    • Rank:
      0|0hzycd:zzzr07zzzzxzzzi
    • XNAT 2021-Q4 Sprint 2

    Description

      When checking whether an event matches a particular event handler, AbstractXftItemEventHandlerMethod.matches(XftItemEventI) calls the XftItemEventCriteria.matches(XftItemEventI) method, which uses a predicate that calls XftItemEventI.getId().

      The problem is that, if the event has multiple IDs, this causes an exception to be thrown, as shown in the attached application.log file.

      For the specific case where I ran into this (updating multiple data types in one action), it would suffice to change to this:

      return event != null &&
             StringUtils.equals(XdatUsergroup.SCHEMA_ELEMENT_NAME, event.getXsiType()) &&
             StringUtils.isNotBlank(event.getId()) &&
             Groups.isProjectGroup(event.getId());
      

      The event wasn't for XdatUsergroup, so it never would have gotten to the ID check. However, there's a legitimate use case for an event with the XdatUsergroup XSI type and multiple IDs, so the criteria and event class should handle it properly.

      To recreate this error, go to Administer -> Data Types, change something in two or more data types (e.g. add "1" to the codes), then click Save.

      Attachments

        Activity

          People

            jrherrick@wustl.edu Rick Herrick
            jrherrick@wustl.edu Rick Herrick
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

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