Uploaded image for project: 'Alfresco'
  1. Alfresco
  2. ALF-21822

NodeServiceXPath: Unsupported operation list.clear()

    Details

    • Story Points:
      1

      Description

      There is a small bug in the class org/alfresco/repo/search/NodeServiceXPath inside alfresco-repository.jar
      This bug causes Alfresco to throw an UnsupportedOperationException in some cases (for example when trying to import an exported ACP).

      At line 193 (inside the method called "selectNodes"), these are the incorrect lines:
      // now return as a list again
      List<Object> results = resultsWithDuplicates;
      results.clear();
      results.addAll(set);

      And they should be replaced by these lines:
      // now return as a list again
      List<Object> results = new ArrayList();
      results.addAll(set);

      The incorrect lines are unnecessarily mutating a collection which should not be mutated, and this incorrect reuse of the collection causes unexpected and unwanted errors. The correct solution is to create and populate a new collection.
      This will not throw anymore the UnsupportedOperationException which was generated by the List subclass returned by super.selectNodes(arg0).

        Attachments

          Issue Links

            Structure

              Activity

                People

                • Assignee:
                  closedissues Closed Issues
                  Reporter:
                  sorinpostelnicu Sorin Postelnicu (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Date of First Response:

                    Structure Helper Panel