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

Fix REST API when setting an Integer property with an empty String

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 10.10-HF60, 2021.14
    • Fix Version/s: 10.10-HF66, 2021.26, 2023.0
    • Component/s: Rest API
    • Release Notes Summary:
      Setting an empty string to other type than string in REST API will behave like null
    • Backlog priority:
      900
    • Sprint:
      nxplatform #70
    • Story Points:
      2

      Description

      As a follow-up of NXP-30806, one case has not been listed in the table in the first comment : an empty string

      Sending a payload like

       {
        "entity-type": "document",
        "uid": "800e2fda-a62b-4378-9620-3845310c41ac",
        "properties": {
          "schema:year": "",
        }
      

      will result in this exception

      {"entity-type":"exception","status":400,"message":"Unable to deserialize property: schema:year"
      ,"stacktrace":"org.nuxeo.ecm.core.io.registry.MarshallingException: Unable to deserialize property: schema:year
      	at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentPropertiesJsonReader.newUnableToDeserializeException(DocumentPropertiesJsonReader.java:362)
      	at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentPropertiesJsonReader.tryParse(DocumentPropertiesJsonReader.java:317)
      	at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentPropertiesJsonReader.getPropertyValue(DocumentPropertiesJsonReader.java:293)
      	at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentPropertiesJsonReader.getScalarPropertyValue(DocumentPropertiesJsonReader.java:242)
      	at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentPropertiesJsonReader.fillScalarProperty(DocumentPropertiesJsonReader.java:178)
      	at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentPropertiesJsonReader.readProperty(DocumentPropertiesJsonReader.java:145)
      	at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentPropertiesJsonReader.read(DocumentPropertiesJsonReader.java:131)
      	at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentPropertiesJsonReader.read(DocumentPropertiesJsonReader.java:91)
      	at org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonReader.read(AbstractJsonReader.java:80)
      	at org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonReader.readEntity(AbstractJsonReader.java:128)
      	at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentModelJsonReader.readEntity(DocumentModelJsonReader.java:108)
      	at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentModelJsonReader.readEntity(DocumentModelJsonReader.java:78)
      	at org.nuxeo.ecm.core.io.marshallers.json.EntityJsonReader.read(EntityJsonReader.java:66)
      	at org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonReader.read(AbstractJsonReader.java:80)
      	at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentModelJsonReader.read(DocumentModelJsonReader.java:96)
      	at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentModelJsonReader.read(DocumentModelJsonReader.java:78)
      	at org.nuxeo.ecm.webengine.jaxrs.coreiodelegate.PartialCoreIODelegate.readFrom(PartialCoreIODelegate.java:127)
      	at com.sun.jersey.spi.container.ContainerRequest.getEntity(ContainerRequest.java:490)
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: