Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-26844

NPE when export/importing from maven repository

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: New
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.29.2
    • Fix Version/s: None
    • Component/s: import-export
    • Labels:
    • Notability:
      3

      Description

      When exporting from a Maven repo with permissive layout and importing to another Maven or Raw repo, artifacts can fail to import due to an NPE:

      To reproduce:

      1. Perform a direct upload of an artifact to a Maven repo via a HTTP PUT e.g.

      curl -v -u admin:admin123 --upload-file ./test.txt http://localhost:8081/repository/maven-releases/com/foo/test.txt

      2. Using the Export/Import tasks, attempt to transfer this artifact to a Raw repo.

      Expected:

      The import task will successfully upload the artifact to the Raw repo.

      Actual:

      Import fails to upload file due to the following NPE:

      java.lang.NullPointerException: null at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:878) at org.sonatype.nexus.common.collect.AttributesMap.<init>(AttributesMap.java:54) at org.sonatype.nexus.common.collect.NestedAttributesMap.<init>(NestedAttributesMap.java:57) at org.sonatype.nexus.common.collect.NestedAttributesMap.<init>(NestedAttributesMap.java:49) at com.sonatype.nexus.exportimport.orient.internal.importtask.OrientImportAttributesService.updateAssetAndComponent(OrientImportAttributesService.java:224) at com.sonatype.nexus.exportimport.orient.internal.importtask.OrientImportAttributesService.importAttributes(OrientImportAttributesService.java:91) at com.sonatype.nexus.exportimport.orient.internal.importtask.OrientRepositoryImportService.lambda$1(OrientRepositoryImportService.java:169) at org.sonatype.nexus.transaction.OperationPoint.lambda$0(OperationPoint.java:53) at org.sonatype.nexus.transaction.OperationPoint.proceed(OperationPoint.java:64) at org.sonatype.nexus.transaction.TransactionalWrapper.proceedWithTransaction(TransactionalWrapper.java:57) at org.sonatype.nexus.transaction.Operations.proceedWithTransaction(Operations.java:232) at org.sonatype.nexus.transaction.Operations.transactional(Operations.java:223) at org.sonatype.nexus.transaction.Operations.run(Operations.java:175) at com.sonatype.nexus.exportimport.orient.internal.importtask.OrientRepositoryImportService.lambda$0(OrientRepositoryImportService.java:162) at com.sonatype.nexus.exportimport.internal.importtask.RepositoryImportSource$RepositoryImportFileVisitor.visitFile(RepositoryImportSource.java:83) at com.sonatype.nexus.exportimport.internal.importtask.RepositoryImportSource$RepositoryImportFileVisitor.visitFile(RepositoryImportSource.java:1) at java.nio.file.Files.walkFileTree(Files.java:2670) at com.sonatype.nexus.exportimport.internal.importtask.RepositoryImportSource.walk(RepositoryImportSource.java:45) at com.sonatype.nexus.exportimport.orient.internal.importtask.OrientRepositoryImportService.walkImportDirectory(OrientRepositoryImportService.java:140) at com.sonatype.nexus.exportimport.orient.internal.importtask.OrientRepositoryImportService.doImport(OrientRepositoryImportService.java:125) at com.sonatype.nexus.exportimport.internal.importtask.RepositoryImportTask.execute(RepositoryImportTask.java:64)

       Caused by the corresponding attributes file, generated by the export task, not having any component attributes i.e.:

      "componentAttributes": null

      Workaround

      Remove the corresponding attributes file for the given artifact from the import directory e.g. <import_dir>/.nexus/com/foo/test.txt and then run the import task again.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              hardeepn Hardeep Nagra
              Last Updated By:
              Michael Oliverio Michael Oliverio
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Date of First Response:

                  tigCommentSecurity.panel-title