[
https://issues.apache.org/jira/browse/JCLOUDS-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13786366#comment-13786366
]
Andrew Gaul commented on JCLOUDS-334:
-------------------------------------
Atmos returns HTTP 201 for successful creation and HTTP 400/code 1016 for
already exists. Thus we could rewrite the fallback handler for createDirectory
to interpret these instead of returning a URI.
For AWS-S3 we could add a custom implementation which calls containerExists
first.
Swift seems like an easy fix like Atmos.
I prefer retaining the existing interface if it requires little effort,
although I doubt many callers rely on it today.
> createContainerInLocation returns true even if container exists
> ---------------------------------------------------------------
>
> Key: JCLOUDS-334
> URL: https://issues.apache.org/jira/browse/JCLOUDS-334
> Project: jclouds
> Issue Type: Bug
> Components: jclouds-blobstore
> Affects Versions: 1.6.2
> Reporter: Diwaker Gupta
>
> Javadocs for `createContainerInLocation` state (from
> http://javadocs.jclouds.cloudbees.net/org/jclouds/blobstore/BlobStore.html):
> "Returns: true if the container was created, false if it already existed."
> The following simple test snippet verifies this:
> ```
> assertThat(blobStore.createContainerInLocation(
> /*location=*/ null, name)).isTrue();
> assertTrue(blobStore.containerExists(name));
> assertThat(blobStore.createContainerInLocation(
> /*location=*/ null, name)).isFalse();
> ```
> I ran the test above for a variety of blobstores, and the test fails for
> pretty much everyblobstore including aws-s3, cloudfiles, hpcloud, azureblob,
> atmos etc. In my tests, it does pass when using generic S3 endpoints like
> with Google cloud storage.
--
This message was sent by Atlassian JIRA
(v6.1#6144)