Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-31924

Fix NPE with quickFilters in Bulk.RunAction

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2021.38
    • Fix Version/s: None
    • Component/s: Bulk

      Description

      When calling the Bulk.RunAction operation, the set of documents on which to operate can be specified either with an NXQL query or a Page Provider and its associated parameters. These PP parameters should be irrelevant (and ignored) if using an NXQL query.

      Scenario

      Call /nuxeo/api/v1/automation/Bulk.RunAction with example payload:

      {
        "params": {
          "action": "automation",
          "query": "SELECT * FROM File",
          "quickFilters": "noFolder",
          "parameters": "{ \"operationId\": \"Document.SetProperty\", \"parameters\": { \"xpath\": \"dc:description\", \"value\": \"updated\", \"save\": true } }"
        }
      }
      

      Expected Result

      The bulk action should run and return a bulkStatus entity as result e.g.:

      {
        "entity-type": "bulkStatus",
        "value": {
          "entity-type": "bulkStatus",
          "commandId": "cf64c92b-83de-4c5a-bbaf-0eb9190c1c5f",
          "state": "SCHEDULED",
          "processed": 0,
          "skipCount": 0,
          "error": false,
          "errorCount": 0,
          "total": 0,
          "action": "automation",
          "username": "admin",
          "submitted": "2023-06-12T08:09:37.078Z",
          "scrollStart": null,
          "scrollEnd": null,
          "processingStart": null,
          "processingEnd": null,
          "completed": null,
          "processingMillis": 0
        }
      }
      

       Actual Result

      The server returns a 500 error code with stacktrace (see attached).

       Note: by adding:

      "providerName": "default_search",
      

       and removing the query (which takes precedence), the command succeeds.

      Additional Notes

      Bulk.RunAction supports the following PP-specific parameters:

      • namedParameters
      • queryParams
      • quickFilters

      All these parameters should be ignored if a query is specified. Specifying a value for queryParams can result in the following exception:

      java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
              at org.nuxeo.ecm.platform.query.nxql.NXQLQueryBuilder.getQuery(NXQLQueryBuilder.java:283) ~[nuxeo-platform-query-api-2021.38.4.jar:?]
              at org.nuxeo.ecm.automation.core.util.PageProviderHelper.buildQueryStringWithPageProvider(PageProviderHelper.java:325) ~[nuxeo-automation-core-2021.38.4.jar:?]
              at org.nuxeo.ecm.automation.core.util.PageProviderHelper.buildQueryStringWithAggregates(PageProviderHelper.java:292) ~[nuxeo-automation-core-2021.38.4.jar:?]
              at org.nuxeo.ecm.automation.core.operations.services.bulk.BulkRunAction.run(BulkRunAction.java:142) ~[nuxeo-automation-features-2021.38.4.jar:?]
      

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              msaye Mark Saye
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: