Tamás Cservenák created JCLOUDS-1552:
----------------------------------------

             Summary: AWSError#parseAWSErrorFromContent attempts to parse the 
response even if there es none
                 Key: JCLOUDS-1552
                 URL: https://issues.apache.org/jira/browse/JCLOUDS-1552
             Project: jclouds
          Issue Type: Bug
          Components: jclouds-blobstore
    Affects Versions: 2.2.1
            Reporter: Tamás Cservenák


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:
{noformat}
{method=HEAD, 
endpoint=http://127.0.0.1:9000/px01-bkt-0579/pointer/public/64/64099abcf2dd581576d8081778110a245eff311d,
 headers={}} {noformat}
response:
{noformat}
{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]} {noformat}
So, payload is there (is not null), but content length is clearly 0. Still, 
org.jclouds.aws.util.AWSUtils#parseAWSErrorFromContent does something like this:
{noformat}
if (response.getPayload() == null) {
  return null;
} else if 
("text/plain".equals(response.getPayload().getContentMetadata().getContentType()))
 {
  return null;
} else {
  .. parse
} {noformat}
Why not check in first IF branch, is payload == null OR payload length is zero?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to