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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.2.1
    • 2.3.0
    • jclouds-blobstore
    • 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

              Unassigned Unassigned
              cstamas Tamas Cservenak
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              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