-
Type: Bug
-
Status: Resolved
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 10.10-HF25
-
Fix Version/s: 10.10-HF54, 2021.12
-
Component/s: Automation
-
Release Notes Summary:The operation Repository.Query handles the parameter 'searchTerm' set to an empty string.
-
Tags:
-
Backlog priority:900
Before HF25 operation Repository.Query did not have a searchTerm parameter, it was added by NXP-27564, so when element nuxeo-document-suggestion called operation Repository.Query and provided a searchTerm parameter with an empty string as value, the operation just ignored. Since HF25 searchTerm parameter is not anymore ignored by the operation but is improperly handled when the value is an empty string.
Here is is curl command simulating the HTTP request sent by element nuxeo-document-suggestion:
NXQL="SELECT * FROM Document WHERE ecm:mixinType != 'HiddenInNavigation' AND ecm:primaryType IN ('Folder','Domain') AND ecm:isProxy = 0 AND ecm:isVersion = 0 AND ecm:isTrashed = 0" curl -su Administrator:Administrator -XPOST -H'Content-Type:application/json' \ http://localhost:8080/nuxeo/api/v1/automation/Repository.Query \ -d "{ \"params\": { \"documentSchemas\":[\"*\"],\"repository\":\"default\",\"prov iderName\":\"default_document_suggestion\",\"pageProviderName\":\"default_document_suggestion\",\"page\":0,\"pageSize\":20,\"query\":\"$NXQL\",\"searchTerm\":\"\" }}" \ | jq
Before HF25 it returns a result.Since HF25 it fails with the following exception:
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1 at org.nuxeo.ecm.platform.query.nxql.NXQLQueryBuilder.getQuery(NXQLQueryBuilder.java:283) ~[nuxeo-platform-query-api-10.10-HF15.jar:?] at org.nuxeo.ecm.platform.query.nxql.CoreQueryDocumentPageProvider.buildQuery(CoreQueryDocumentPageProvider.java:239) ~[nuxeo-platform-query-api-10.10-HF15.jar:?] at org.nuxeo.ecm.platform.query.nxql.CoreQueryDocumentPageProvider.getCurrentPage(CoreQueryDocumentPageProvider.java:117) ~[nuxeo-platform-query-api-10.10-HF15.jar:?] at org.nuxeo.ecm.automation.core.util.PaginablePageProvider.<init>(PaginablePageProvider.java:43) ~[nuxeo-core-io-10.10-HF25.jar:?] at org.nuxeo.ecm.automation.jaxrs.io.documents.PaginableDocumentModelListImpl.<init>(PaginableDocumentModelListImpl.java:49) ~[nuxeo-core-io-10.10-HF25.jar:?] at org.nuxeo.ecm.automation.jaxrs.io.documents.PaginableDocumentModelListImpl.<init>(PaginableDocumentModelListImpl.java:39) ~[nuxeo-core-io-10.10-HF25.jar:?] at org.nuxeo.ecm.automation.core.operations.services.query.DocumentPaginatedQuery.run(DocumentPaginatedQuery.java:126) ~[nuxeo-automation-features-10.10-HF25.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181] at org.nuxeo.ecm.automation.core.impl.InvokableMethod.doInvoke(InvokableMethod.java:167) ~[nuxeo-automation-core-10.10-HF25.jar:?] at org.nuxeo.ecm.automation.core.impl.InvokableMethod.invoke(InvokableMethod.java:179) ~[nuxeo-automation-core-10.10-HF25.jar:?] at org.nuxeo.ecm.automation.core.impl.OperationChainCompiler$OperationMethod.invoke(OperationChainCompiler.java:151) ~[nuxeo-automation-core-10.10-HF25.jar:?] at org.nuxeo.ecm.automation.core.impl.OperationChainCompiler$CompiledChainImpl.lambda$invoke$0(OperationChainCompiler.java:218) ~[nuxeo-automation-core-10.10-HF25.jar:?] at org.nuxeo.ecm.automation.OperationContext.call(OperationContext.java:326) ~[nuxeo-automation-core-10.10-HF25.jar:?] at org.nuxeo.ecm.automation.OperationContext.callWithChainParameters(OperationContext.java:291) ~[nuxeo-automation-core-10.10-HF25.jar:?] at org.nuxeo.ecm.automation.core.impl.OperationChainCompiler$CompiledChainImpl.invoke(OperationChainCompiler.java:215) ~[nuxeo-automation-core-10.10-HF25.jar:?] at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.run(OperationServiceImpl.java:115) ~[nuxeo-automation-core-10.10-HF25.jar:?] at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.lambda$run$0(OperationServiceImpl.java:105) ~[nuxeo-automation-core-10.10-HF25.jar:?] at org.nuxeo.ecm.automation.OperationContext.call(OperationContext.java:326) ~[nuxeo-automation-core-10.10-HF25.jar:?] at org.nuxeo.ecm.automation.OperationContext.callWithChainParameters(OperationContext.java:291) ~[nuxeo-automation-core-10.10-HF25.jar:?] at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.run(OperationServiceImpl.java:105) ~[nuxeo-automation-core-10.10-HF25.jar:?] at org.nuxeo.ecm.automation.server.jaxrs.OperationResource.execute(OperationResource.java:58) ~[nuxeo-automation-server-10.10-HF15.jar:?] at org.nuxeo.ecm.automation.server.jaxrs.ExecutableResource.doPost(ExecutableResource.java:70) ~[nuxeo-automation-server-10.10-HF15.jar:?] ... 126 more
This happens because now searchTerm is an alias for parameter queryParams, and wrongfully considers an empty string as a valid value, it actually should be ignored.
See complete stacktrace in NXP-29097_stacktrace.log.
A workaround is to provide null as value to searchTerm instead of "".
- is caused by
-
NXP-27564 Fix JSF UI's document suggestion widgets when configured with a NXQL query
- Resolved
- Is referenced in