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

Able to create repository on blobstore that does not exist, causing NullPointerException

Details

    • 3

    Description

      Problem

      The repository REST API allows create of a repository on a blobstore that does not exist. This the causes NullPointerException. 

      Steps to Reproduce

      1) Using REST API, create a hosted raw repo on blobstore that does not exist

      2021-05-26 11:24:18,824+0100 INFO  [qtp250102189-327] admin org.sonatype.nexus.repository.manager.internal.RepositoryManagerImpl - Creating repository: internal -> OrientConfiguration{repositoryName='internal', recipeName='raw-hosted', attributes=

      Unknown macro: {cleanup= Unknown macro}

      , raw={contentDisposition=ATTACHMENT}, storage={strictContentTypeValidation=true, writePolicy=allow_once, blobStoreName=mks_test}}}

      2) Delete newly created hosted raw repo and you get below NullPointerException

      2021-05-26 11:26:23,504+0100 INFO  [qtp250102189-68] admin org.sonatype.nexus.repository.manager.internal.RepositoryManagerImpl - Deleting repository: internal

      2021-05-26 11:26:23,531+0100 ERROR [qtp250102189-68] admin org.sonatype.nexus.repository.storage.StorageFacetImpl - Failed transition: STOPPED -> DELETED

      java.lang.NullPointerException: null

       at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:878)

       at org.sonatype.nexus.repository.storage.internal.StorageFacetManagerImpl.enqueueDeletion(StorageFacetManagerImpl.java:85)

       at org.sonatype.nexus.common.stateguard.MethodInvocationAction.run(MethodInvocationAction.java:39)

       at org.sonatype.nexus.common.stateguard.StateGuard$GuardImpl.run(StateGuard.java:272)

       at org.sonatype.nexus.common.stateguard.GuardedInterceptor.invoke(GuardedInterceptor.java:54)

       at org.sonatype.nexus.repository.storage.StorageFacetImpl.lambda$3(StorageFacetImpl.java:224)

       at org.sonatype.nexus.orient.transaction.OrientOperations.lambda$2(OrientOperations.java:62)

       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 org.sonatype.nexus.orient.transaction.OrientOperations.run(OrientOperations.java:62)

       at org.sonatype.nexus.repository.storage.StorageFacetImpl.doDelete(StorageFacetImpl.java:222)

       at org.sonatype.nexus.repository.FacetSupport.delete(FacetSupport.java:178)

       

      Expected Behaviour

      The Nexus REST API should not allow the repository to be created if blobstore does not exist or if any other setting is invalid.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              msurani Mahendra Surani
              Hardeep Nagra Hardeep Nagra
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                tigCommentSecurity.panel-title