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

add ability to dump invalid JSON payloads submitted by docker on parse errors

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.0
    • Fix Version/s: 3.1.0
    • Component/s: Docker
    • Labels:
    • Story Points:
      1
    • Sprint:
      Sprint 70

      Description

      Nexus may fail parsing docker client JSON payloads. When this happens we see an exception that refers to a token, but we have no easy way inside Nexus to get the complete invalid payload.

      2016-04-19 15:10:11,307+0100 DEBUG [qtp1004501170-40] admin org.sonatype.nexus.repository.docker.internal.DockerContentValidator - Invalid JSON file v2/-/blobs/sha256:41f11486b420ff71ab6334060f9cd36129358b6442edce01f1bb05a7d1cdd8a6
      com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'opt': was expecting ('true', 'false' or 'null')
       at [Source: sun.nio.ch.ChannelInputStream@72441c66; line: 1, column: 5]
      	at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1586) [com.fasterxml.jackson.core.jackson-core:2.7.1]
      	at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:521) [na:na]
      	at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidToken(UTF8StreamJsonParser.java:3466) [na:na]
      	at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._handleUnexpectedValue(UTF8StreamJsonParser.java:2625) [na:na]
      	at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._nextTokenNotInObject(UTF8StreamJsonParser.java:854) [na:na]
      	at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:748) [na:na]
      	at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3828) [com.fasterxml.jackson.core.jackson-databind:2.7.1]
      	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3773) [com.fasterxml.jackson.core.jackson-databind:2.7.1]
      	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2856) [com.fasterxml.jackson.core.jackson-databind:2.7.1]
      	at org.sonatype.nexus.repository.docker.internal.DockerContentValidator.isValidJson(DockerContentValidator.java:221) [com.sonatype.nexus.plugins.nexus-repository-docker:3.0.0.03]
      	at org.sonatype.nexus.repository.docker.internal.DockerContentValidator.v2DetermineContentType(DockerContentValidator.java:146) [com.sonatype.nexus.plugins.nexus-repository-docker:3.0.0.03]
      	at org.sonatype.nexus.repository.docker.internal.DockerContentValidator.determineContentType(DockerContentValidator.java:87) [com.sonatype.nexus.plugins.nexus-repository-docker:3.0.0.03]
      	at org.sonatype.nexus.repository.storage.StorageTxImpl.determineContentType(StorageTxImpl.java:717) [org.sonatype.nexus.repository:3.0.0.03]
      	at org.sonatype.nexus.repository.storage.StorageTxImpl.createBlob(StorageTxImpl.java:544) [org.sonatype.nexus.repository:3.0.0.03]
      	at org.sonatype.nexus.repository.storage.StorageTxImpl.setBlob(StorageTxImpl.java:651) [org.sonatype.nexus.repository:3.0.0.03]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [na:1.8.0_72]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [na:1.8.0_72]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [na:1.8.0_72]
      	at java.lang.reflect.Method.invoke(Method.java:498) [na:1.8.0_72]
      
      

      Acceptance

      • print the full JSON payload in the nexus.log if there is a parse error
      • ideally print the line/character number in the JSON payload where the error is detected parse exception already does this
      • make it configurable to print or not print the payload ( in case the payload could contain sensitive data )

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jtom Joe Tom
                Reporter:
                plynch Peter Lynch
                Last Updated By:
                Peter Lynch
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Date of First Response: