Hi Andrew,

Thanks for the explanation.

I created a JIRA issue and joined the channel. Will try to create a
patch for it, and notify you about it. However, it will probably take
me some 2-3w, as I need to get the clearance first...

Best,
Nikola

On Tue, Jul 16, 2013 at 6:14 PM, Andrew Gaul <[email protected]> wrote:
> I verified this behavior against S3.  jclouds-karaf has logic in
> BlobStoreCommandBase.getBlobInputStream which handles null results from
> getBlob.  When null it calls containerExists, and if containerExists
> returns true it throws ContainerNotFoundException otherwise it throws
> KeyNotFoundException.
>
> I find this behavior confusing and suspect that we could push this logic
> into getBlob itself.  We could introspect on the provider-specific error
> type to avoid the extra containerExists call, e.g.,
> ParseAWSErrorFromXmlContent.refineException.
>
> Nikola, would you like to open a JIRA issue and submit a patch to
> GitHub?  Please join us in #jclouds on irc.freenode.net and I can help
> you get started!
>
> On Fri, Jul 12, 2013 at 02:34:02PM +0200, Nikola Knezevic wrote:
>> Hi,
>>
>> can someone help me, I don't know what I'm doing wrong... I'm making some
>> tests, and there I also check if getBlob throws me the right exception when
>> the container (not blob, but container) does not exist. However, my tests
>> are failing, because I keep getting null.
>>
>> The code in question 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
>>
>>
>> Thanks,
>> Nikola
>
> --
> Andrew Gaul
> http://gaul.org/

Reply via email to