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

Fix parsing of null dates

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2021
    • Fix Version/s: 2023.0, 2021.32
    • Component/s: Core
    • Release Notes Summary:
      Handle null SavedSearchRequest params.
    • Backlog priority:
      700
    • Sprint:
      nxplatform #77, nxplatform #78, nxplatform #79
    • Story Points:
      3

      Description

      Steps to reproduce:

      1. define a page provider with at least one date field
      2. define the corresponding search form with the Date widgets
      3. deploy
      4. navigate to the search
      5. set the Date fields
      6. run the search and observe the expected results are returned
      7. empty one search field, run the search and observe that the expected results are returned
      8. click on the Save as button, enter a search name and validate
      9. observe that nothing happens. If you open the Console, you'll see an error with the message
        {entity-type: 'exception', status: 400, message: 'java.lang.IllegalArgumentException: Failed to parse ISO 8601 date: null'} 

        and the Network tab show that the corresponding POST requests returns an error HTTP 400 with the same message

      The corresponding search request is

      curl 'http://localhost:8080/nuxeo/api/v1/search/saved' \
        -H 'Content-Type: application/json' \
        -H 'Cookie: JSESSIONID=6F2E6196805FFD43C1F5C239BD317615.nuxeo; org.jboss.seam.core.TimeZone=Europe/Berlin; org.jboss.seam.core.Locale=fr_FR; OAuth_Token_Request_State=b58f8eed-a950-422b-aa11-6183ca40e3fd; __gsas=ID=6e9696e27ea1bfc4:T=1667836578:S=ALNI_MbBCe0WPfUBgtzoNAP_QaDCwdtgrA; nuxeo.start.url.fragment=' \
        -H 'accept: text/plain,application/json, application/json' \
        -H 'properties: *' \
        --data-raw '{"entity-type":"savedSearch","pageProviderName":"datesearch","params":{"dublincore_modified_1":null,"dublincore_modified":"2022-11-10T23:00:00.000Z"},"title":"apres11nov2022"}' \
        --compressed 

      In Nuxeo logs, there is this stacktrace

      2022-11-28T10:38:50,007 WARN  [WebEngineExceptionMapper] java.lang.IllegalArgumentException: Failed to parse ISO 8601 date: null
      java.lang.IllegalArgumentException: Failed to parse ISO 8601 date: null
      	at org.nuxeo.ecm.core.schema.utils.DateParser.parseW3CDateTime(DateParser.java:89) ~[nuxeo-core-schema-2021.25.8.jar:?]
      	at org.nuxeo.ecm.core.schema.types.primitives.DateType.decode(DateType.java:70) ~[nuxeo-core-schema-2021.25.8.jar:?]
      	at org.nuxeo.ecm.automation.core.util.DocumentHelper.setProperty(DocumentHelper.java:337) ~[nuxeo-automation-core-2021.18.6.jar:?]
      	at org.nuxeo.ecm.automation.core.util.DocumentHelper.setProperty(DocumentHelper.java:308) ~[nuxeo-automation-core-2021.18.6.jar:?]
      	at org.nuxeo.ecm.restapi.server.jaxrs.search.SearchObject.setSaveSearchParams(SearchObject.java:273) ~[nuxeo-search-rest-api-2021.12.6.jar:?]
      	at org.nuxeo.ecm.restapi.server.jaxrs.search.SearchObject.doSaveSearch(SearchObject.java:189) ~[nuxeo-search-rest-api-2021.12.6.jar:?]
      ...
      Caused by: java.text.ParseException: Invalid year in date 'null'
      	at org.nuxeo.ecm.core.schema.utils.DateParser.readYear(DateParser.java:125) ~[nuxeo-core-schema-2021.25.8.jar:?]
      	at org.nuxeo.ecm.core.schema.utils.DateParser.parse(DateParser.java:49) ~[nuxeo-core-schema-2021.25.8.jar:?]
      	at org.nuxeo.ecm.core.schema.utils.DateParser.parseW3CDateTime(DateParser.java:87) ~[nuxeo-core-schema-2021.25.8.jar:?]
      	... 155 more
      

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: