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

Don't crash when doing XML import of unknown document type

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 7.10, 8.10, 9.2
    • Fix Version/s: 7.10-HF31, 8.10-HF14, 9.3
    • Component/s: Importer
    • Release Notes Summary:
      Unknown document type when doing XML import raises DocumentNotFoundException
    • Tags:
    • Story Points:
      1

      Description

      1. install Nuxeo
      2. install nuxeo-dam addon
      3. create a workspace
      4. create a note
      5. export using the Zip tree export
      1. install another Nuxeo with the same version
      2. don't install the nuxeo-dam addon
      3. drop the exported zip on the domain

      This generates the following stack:

      ****** chain ******
      Name: FileManager.ImportInSeam
      Exception: OperationException
      Caught error: Failed to invoke operation FileManager.Import
      Caused by: java.lang.NullPointerException
      ****** Hierarchy calls ******
          org.nuxeo.ecm.automation.core.operations.services.FileManagerImport
      
          at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.run(OperationServiceImpl.java:238)
          at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.run(OperationServiceImpl.java:121)
          at org.nuxeo.ecm.automation.server.jaxrs.batch.BatchManagerComponent.execute(BatchManagerComponent.java:302)
          ... 118 more
      Caused by: org.nuxeo.ecm.automation.OperationException: Failed to invoke operation FileManager.Import
          at org.nuxeo.ecm.automation.core.impl.InvokableMethod.invoke(InvokableMethod.java:189)
          at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.doInvoke(CompiledChainImpl.java:130)
          at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.invoke(CompiledChainImpl.java:116)
          at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.run(OperationServiceImpl.java:214)
          ... 120 more
      Caused by: java.lang.NullPointerException
          at org.nuxeo.ecm.core.io.impl.AbstractDocumentModelWriter.loadFacetsInfo(AbstractDocumentModelWriter.java:226)
          at org.nuxeo.ecm.core.io.impl.AbstractDocumentModelWriter.createDocument(AbstractDocumentModelWriter.java:147)
          at org.nuxeo.ecm.core.io.impl.plugins.DocumentModelWriter.doWrite(DocumentModelWriter.java:88)
          at org.nuxeo.ecm.core.io.impl.plugins.DocumentModelWriter.write(DocumentModelWriter.java:75)
          at org.nuxeo.ecm.core.io.impl.AbstractDocumentWriter.write(AbstractDocumentWriter.java:53)
          at org.nuxeo.ecm.core.io.impl.DocumentPipeImpl.readAndWriteDocs(DocumentPipeImpl.java:127)
          at org.nuxeo.ecm.core.io.impl.DocumentPipeImpl.run(DocumentPipeImpl.java:102)
          at org.nuxeo.ecm.platform.routing.core.persistence.RouteModelsZipImporter.create(RouteModelsZipImporter.java:94)
          at org.nuxeo.ecm.platform.filemanager.service.FileManagerService.createDocumentFromBlob(FileManagerService.java:257)
          at org.nuxeo.ecm.automation.core.operations.services.FileManagerImport.run(FileManagerImport.java:76)
          at org.nuxeo.ecm.automation.core.operations.services.FileManagerImport.run(FileManagerImport.java:84)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at org.nuxeo.ecm.automation.core.impl.InvokableMethod.doInvoke(InvokableMethod.java:171)
          at org.nuxeo.ecm.automation.core.impl.InvokableMethod.invoke(InvokableMethod.java:177)
          ... 123 more
      

      The Picture type is unknown to the target instance and thus throws this stack.

      In AbstractDocumentModelWriter.loadFacetsInfo there is no check for the document type which is null:

                  if (facetType == null) {
                      log.warn("The document " + docModel.getName() + " with id=" + docModel.getId() + " and type="
                              + docModel.getDocumentType().getName() + " contains the facet '" + facet
                              + "', which is not registered as available in the schemaManager. This facet will be ignored.");
      

      The behavior that we actually want is the same behavior that we have when we import a document of an unknown document type that that does contain unknown facets: throw DocumentNotFoundException: Unknown document type: MyType

        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 - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours
                  2h