Uploaded image for project: 'CMS'
  1. CMS
  2. CMS-12125

Improve handling of duplicate view item in ReferenceTableSearchUIModel

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • 4.8.4, 4.9.0
    • 4.8.0
    • None
    • None
    • 4.9.0 M3

      A criterion is added for each item of the view. But if a attribute is present twice in the view, this will fails with the following error :

      A component for the role 'itemPath' is already registered on this ComponentManager.
      java.lang.IllegalArgumentException: A component for the role 'itemPath' is already registered on this ComponentManager.
          at org.ametys.runtime.plugin.component.ThreadSafeComponentManager._addComponent(ThreadSafeComponentManager.java:323)
          at org.ametys.runtime.plugin.component.ThreadSafeComponentManager.addComponent(ThreadSafeComponentManager.java:311)
          at org.ametys.cms.search.ui.model.ReferenceTableSearchUIModel.addAttributeCriterionComponent(ReferenceTableSearchUIModel.java:356)
          at org.ametys.cms.search.ui.model.ReferenceTableSearchUIModel.addCriteriaComponents(ReferenceTableSearchUIModel.java:233)
          at org.ametys.cms.search.ui.model.ReferenceTableSearchUIModel.addCriteriaComponents(ReferenceTableSearchUIModel.java:195)
          at org.ametys.cms.search.ui.model.ReferenceTableSearchUIModel.getCriteria(ReferenceTableSearchUIModel.java:144)
      

      worse, this will leave the component is a bogus state where every following calls will fails with a similiar error but this time accusing the first item of the view.

      This is because the criterion manager is partially initialized but we check the _searchCriteria map to determine if we need to initialize it.

            Unassigned Unassigned
            ggouin Guillaume Gouin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: