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

Trying to parse S3 HEAD error response causes IllegalArgumentException: not an xml document

    XMLWordPrintableJSON

    Details

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

      Description

      When a HEAD call to S3 results in error the attempt to parse response body causes an exception and an error to be logged.

      2020/11/09 20:20:00.000205 WARN  <org.jclouds.aws.util.AWSUtils taskScheduler-3> error parsing error
      java.lang.RuntimeException: request: HEAD https://<REDACTED> HTTP/1.1; response: HTTP/1.1 404 Not Found; cause: java.lang.RuntimeException: request: HEAD https://<REDACTED> HTTP/1.1; response: HTTP/1.1 404 Not Found; source:
      ; cause: java.lang.IllegalArgumentException: not an xml document []
              at org.jclouds.http.functions.ParseSax.addDetailsAndPropagate(ParseSax.java:174)
              at org.jclouds.http.functions.ParseSax.addDetailsAndPropagate(ParseSax.java:146)
              at org.jclouds.http.functions.ParseSax.apply(ParseSax.java:86)
              at org.jclouds.aws.util.AWSUtils.parseAWSErrorFromContent(AWSUtils.java:90)
              at org.jclouds.aws.handlers.ParseAWSErrorFromXmlContent.handleError(ParseAWSErrorFromXmlContent.java:73)
              at org.jclouds.http.handlers.DelegatingErrorHandler.handleError(DelegatingErrorHandler.java:65)
              at org.jclouds.http.internal.BaseHttpCommandExecutorService.shouldContinue(BaseHttpCommandExecutorService.java:138)
              at org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:107)
              at org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:91)
              at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:74)
              at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:45)
              at org.jclouds.rest.internal.DelegatesToInvocationFunction.handle(DelegatesToInvocationFunction.java:156)
              at org.jclouds.rest.internal.DelegatesToInvocationFunction.invoke(DelegatesToInvocationFunction.java:123)
              at com.sun.proxy.$Proxy180.objectExists(Unknown Source)
              at org.jclouds.s3.blobstore.S3BlobStore.blobExists(S3BlobStore.java:208)
              <REDACTED>...
      Caused by: java.lang.RuntimeException: request: HEAD https://<REDACTED> HTTP/1.1; response: HTTP/1.1 404 Not Found; source:
      ; cause: java.lang.IllegalArgumentException: not an xml document []
              at org.jclouds.http.functions.ParseSax.addDetailsAndPropagate(ParseSax.java:174)
              at org.jclouds.http.functions.ParseSax.convertStreamToStringAndParse(ParseSax.java:102)
              at org.jclouds.http.functions.ParseSax.apply(ParseSax.java:82)
              ... 31 more
      Caused by: java.lang.IllegalArgumentException: not an xml document []
              at com.google.common.base.Preconditions.checkArgument(Preconditions.java:164)
              at org.jclouds.http.functions.ParseSax.validateXml(ParseSax.java:117)
              at org.jclouds.http.functions.ParseSax.convertStreamToStringAndParse(ParseSax.java:98)
              ... 32 more
      

      According to RFC 2616, "... The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. ..."

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                zhenhuan Zhen-Huan HWANG
              • 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 - 10m
                  10m