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

getBlob and putBlob do not throw ContainerNotFoundException on non-existent bucket

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Critical
    • Resolution: Unresolved
    • 1.6.0, 1.6.1
    • None
    • jclouds-blobstore
    • None

    Description

      getBlob method of BlobStore is assumed to throw ContainerNotFoundException exception if the underlying container does not exist. However, for S3 and Rackspace providers (only these two were tested) it does not - it simply returns null. This severely breaks the API, as it differs from the documentation. Moreover, FileSystem provider correctly throws the exception.

      Test code that shows the incorrect behaviour is here:
      https://gist.github.com/anonymous/5984101

      Some (IMHO) relevant output is here:

      [main][]       ContainerExistTest:getBlob - Getting blob 'uploadedImage' from 'wrongtest-container-1'
      [main][] keSyncToAsyncHttpMethod:logTrace - >> converting GetObject
      [main][] RestAnnotationProcessor:logTrace - using endpoint Optional.of(https://s3.amazonaws.com) for public abstract com.google.common.util.concurrent.ListenableFuture org.jclouds.s3.S3AsyncClient.getObject(java.lang.String,java.lang.String,org.jclouds.http.options.GetOptions[])[wrongtest-container-1, uploadedImage, [Lorg.jclouds.http.options.GetOptions;@707b11cf]
      [main][] RestAnnotationProcessor:logTrace - adding filter org.jclouds.s3.filters.RequestAuthorizeSignature@46f50ae2 from annotation on org.jclouds.s3.S3AsyncClient
      [main][] keSyncToAsyncHttpMethod:logTrace - << converted GetObject to GET https://wrongtest-container-1.s3.amazonaws.com/uploadedImage HTTP/1.1
      [main][] keSyncToAsyncHttpMethod:logTrace - << response from GetObject is parsed by ParseObjectFromHeadersAndHttpContent
      [main][] keSyncToAsyncHttpMethod:logTrace - << exceptions from GetObject are parsed by NullOnKeyNotFound
      [main][] keSyncToAsyncHttpMethod:logDebug - >> invoking GetObject
      [main][]               signature:logDebug - >> GET https://wrongtest-container-1.s3.amazonaws.com/uploadedImage HTTP/1.1
      [main][]               signature:logDebug - >> Host: wrongtest-container-1.s3.amazonaws.com
      [main][]               signature:logDebug - >> Date: Fri, 12 Jul 2013 12:25:11 GMT
      [main][]               signature:logDebug - >> "GET[\n]"
      [main][]               signature:logDebug - >> "[\n]"
      [main][]               signature:logDebug - >> "[\n]"
      [main][]               signature:logDebug - >> "Fri, 12 Jul 2013 12:25:11 GMT[\n]"
      [main][]               signature:logDebug - >> "/wrongtest-container-1/uploadedImage"
      [main][]               signature:logDebug - << GET https://wrongtest-container-1.s3.amazonaws.com/uploadedImage HTTP/1.1
      [main][]               signature:logDebug - << Host: wrongtest-container-1.s3.amazonaws.com
      [main][]               signature:logDebug - << Date: Fri, 12 Jul 2013 12:25:11 GMT
      [main][] pCommandExecutorService:logDebug - Sending request 2132681414: GET https://wrongtest-container-1.s3.amazonaws.com/uploadedImage HTTP/1.1
      [main][]                 headers:logDebug - >> GET https://wrongtest-container-1.s3.amazonaws.com/uploadedImage HTTP/1.1
      [main][]                 headers:logDebug - >> Host: wrongtest-container-1.s3.amazonaws.com
      [main][]                 headers:logDebug - >> Date: Fri, 12 Jul 2013 12:25:11 GMT
      [main][] pCommandExecutorService:logDebug - Receiving response 2132681414: HTTP/1.1 404 Not Found
      [main][]                 headers:logDebug - << HTTP/1.1 404 Not Found
      [main][]                 headers:logDebug - << x-amz-request-id: 3EE5AFE13C3ACE57
      [main][]                 headers:logDebug - << Date: Fri, 12 Jul 2013 12:25:14 GMT
      [main][]                 headers:logDebug - << Transfer-Encoding: chunked
      [main][]                 headers:logDebug - << x-amz-id-2: <snip>
      [main][]                 headers:logDebug - << Server: AmazonS3
      [main][]                 headers:logDebug - << Content-Type: application/xml
      [main][]                    wire:logDebug - << "<?xml version="1.0" encoding="UTF-8"?>[\n]"
      [main][]                    wire:logDebug - << "<Error><Code>NoSuchBucket</Code><Message>The specified bucket does not exist</Message><BucketName>wrongtest-container-1</BucketName><RequestId>3EE5AFE13C3ACE57</RequestId><HostId>snip</HostId></Error>"
      [main][]       ContainerExistTest:getBlob - Got blob 'null'
      [main][] tainerExistTest:verifyOperations - Got this blob!? null
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              knl Nikola Knezevic
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated: