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

error message lacks context for /rest/v1/staging/move operation when destination already contains component

    Details

      Description

      Try a staging move operation for a tagged component that already exists in the destination. The resulting error message prints java object representation instead of component details:

      Destination already contains component: org.sonatype.nexus.repository.content.fluent.internal.FluentComponentImpl@40e26345

      
      > curl -v -u admin:admin123 -X POST "http://localhost:9081/nexus/service/rest/v1/staging/move/releases?tag=1651757784924"
      *   Trying 127.0.0.1:9081...
      * Connected to localhost (127.0.0.1) port 9081 (#0)
      * Server auth using Basic with user 'admin'
      > POST /nexus/service/rest/v1/staging/move/releases?tag=1651757784924 HTTP/1.1
      > Host: localhost:9081
      > Authorization: Basic YWRtaW46YWRtaW4xMjM=
      > User-Agent: curl/7.82.0
      > Accept: */*
      > 
      * Mark bundle as not supporting multiuse
      < HTTP/1.1 400 Bad Request
      < Date: Thu, 05 May 2022 13:39:39 GMT
      < Server: Nexus/3.38.1-01 (PRO)
      < X-Content-Type-Options: nosniff
      < Content-Type: application/json
      < Content-Length: 351
      < 
      {
        "status" : 400,
        "message" : "Destination already contains component: org.sonatype.nexus.repository.content.fluent.internal.FluentComponentImpl@40e26345",
        "data" : {
          "source" : {
            "repository" : "cc-releases",
            "format" : "maven2"
          },
          "destination" : {
            "repository" : "releases",
            "format" : "maven2"
          }
        }
      * Connection #0 to host localhost left intact
      }
      
      

      There is evidence that this used to provide a more meaningful message with OrientDB. For example, from NEXUS-24391, there was this example:

      curl -u admin:admin123 -X POST "http://node1.example.com:8081/service/rest/v1/staging/move/docker-hosted-test?docker.imageName=buildtoolstest&docker.imageTag=v1.0&repository=docker-hosted"
      
      {
        "status" : 400,
        "message" : "Destination already contains component: group=null, name=buildtoolstest, version=v1.0, format=docker",
        "data" : {
          "source" : {
            "repository" : "docker-hosted",
            "format" : "docker"
          },
          "destination" : {
            "repository" : "docker-hosted-test",
            "format" : "docker"
          }
        }
      }
      

      Expected

      The error message should describe in a performant and intuitive way what component is already in the destination.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            plynch Peter Lynch
            Last Updated By:
            Abrash Pervaiz Abrash Pervaiz
            Team:
            NXRM - Neo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                tigCommentSecurity.panel-title