Uploaded image for project: 'jclouds'
  1. jclouds
  2. JCLOUDS-1552

AWSError#parseAWSErrorFromContent attempts to parse the response even if there is none

Agile BoardAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.1
    • Fix Version/s: 2.3.0
    • Component/s: jclouds-blobstore
    • Labels:
      None

      Description

      With S3 BlobStore request, asking HEAD of non existent object (below request dumped from debug) gets a response with 404 and no XML body, but AWSUtil still tries (and fails) to parse the error from response, filling up log with noise.

      S3 Server is Minio:

      request:

      {method=HEAD, endpoint=http://127.0.0.1:9000/px01-bkt-0579/pointer/public/64/64099abcf2dd581576d8081778110a245eff311d, headers={}} 

      response:

      {statusCode=404, message=Not Found, headers={Accept-Ranges=[bytes], Content-Security-Policy=[block-all-mixed-content], Server=[MinIO/RELEASE.2020-09-08T23-05-18Z], Vary=[Origin], X-Amz-Request-Id=[1633B89A38D5D1CC], X-Xss-Protection=[1; mode=block], Date=[Fri, 11 Sep 2020 11:54:25 GMT]}, payload=[content=true, contentMetadata=[cacheControl=null, contentDisposition=null, contentEncoding=null, contentLanguage=null, contentLength=0, contentMD5=null, contentType=application/unknown, expires=null], written=false, isSensitive=false]} 

      So, payload is there (is not null), but content length is clearly 0. Still, org.jclouds.aws.util.AWSUtils#parseAWSErrorFromContent does something like this:

      if (response.getPayload() == null) {
        return null;
      } else if ("text/plain".equals(response.getPayload().getContentMetadata().getContentType())) {
        return null;
      } else {
        .. parse
      } 

      Why not check in first IF branch, is payload == null OR payload length is zero?

        Attachments

        Issue Links

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              cstamas Tamás Cservenák

              Dates

              • Created:
                Updated:
                Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0h
              0h
              Logged:
              Time Spent - 2.5h
              2.5h

                Issue deployment