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

TaskWriter must not write nonexistent target documents

    XMLWordPrintable

    Details

    • Release Notes Summary:
      The marshaller for Task objects do not write non existent target documents
    • Sprint:
      nxfit 9.3.6
    • Story Points:
      3

      Description

      Theoretically, when a document is deleted, its tasks get deleted by the DeleteTaskForDeletedDocumentListener.
      Yet some cases were noticed where a task targeting a deleted document remains.

      In such a case, we don't want the TaskWriter to write the document id in the "targetDocumentIds" field because the client won't know how to handle it.
      The issue was seen on https://webui-demo.nuxeo.com/ on a task targeting a nonexistent document making the mobile app fail when fetching the user's tasks.

      Faulty code in TaskWriter:

      for (String docId : item.getTargetDocumentsIds()) {
          if (isFetchTargetDocumentIds) {
              IdRef idRef = new IdRef(docId);
              if (wrapper.getSession().exists(idRef)) {
                  writeEntity(wrapper.getSession().getDocument(idRef), jg);
                  break;
              }
          }
          jg.writeStartObject();
          jg.writeStringField("id", docId);
          jg.writeEndObject();
      }
      jg.writeEndArray();
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 hours
                  4h