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

Fix Rest API when setting multivalued Integer Property

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 10.10-HF58, 2021.15
    • Fix Version/s: 10.10-HF63, 2021.22
    • Component/s: Rest API
    • Release Notes Summary:
      REST API updates correctly multivalued Integer properties.
    • Backlog priority:
      1,000
    • Sprint:
      nxplatform #63
    • Story Points:
      3

      Description

      Steps to reproduce
      1. Define a multivalued integer property
      2. Try to create a document with this property, e.g

      curl -X POST -H 'Content-Type: application/json' -u Administrator:Administrator -d '{"entity-type": "document", "name": "Test File", "type": "File", "properties": {"dc:title": "Test File", "test:test":[1234, 12345, 12345678]}}' http://localhost:8080/nuxeo/api/v1/path/default-domain/workspaces/WS1
      

      Expected Results: The document is successfully created
      Actual Results: The following error is received

      2022-05-26T10:56:22,360 ERROR [http-nio-0.0.0.0-8080-exec-16] [org.nuxeo.ecm.webengine.app.WebEngineExceptionMapper] java.lang.ArrayStoreException: arraycopy: element type mismatch: can not cast one of the elements of java.lang.Object[] to the type of the destination array, java.lang.Long
      java.lang.ArrayStoreException: arraycopy: element type mismatch: can not cast one of the elements of java.lang.Object[] to the type of the destination array, java.lang.Long
              at java.util.ArrayList.toArray(ArrayList.java:433) ~[?:?]
              at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentPropertiesJsonReader.castArrayPropertyValue(DocumentPropertiesJsonReader.java:189) ~[nuxeo-core-io-10.10-HF59.jar:?]
              at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentPropertiesJsonReader.fillScalarProperty(DocumentPropertiesJsonReader.java:176) ~[nuxeo-core-io-10.10-HF59.jar:?]
      

      Note that changing the above multivalued property to

      "test:test":["1234", "12345", "12345678"]
      

      allows the document to be created successfully.
      The request with integers works in HF56 but fails in HF58 and later. I think that it's a regression from NXP-30806

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: