mirror of https://github.com/apache/jclouds.git
s3: fixed ssl error on bucket not found
git-svn-id: http://jclouds.googlecode.com/svn/trunk@2609 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
1661ff18fd
commit
aab7fd12dc
|
@ -48,6 +48,7 @@ import org.jclouds.aws.s3.filters.RequestAuthorizeSignature;
|
|||
import org.jclouds.aws.s3.functions.ObjectKey;
|
||||
import org.jclouds.aws.s3.functions.ParseObjectFromHeadersAndHttpContent;
|
||||
import org.jclouds.aws.s3.functions.ParseObjectMetadataFromHeaders;
|
||||
import org.jclouds.aws.s3.functions.ReturnFalseOn404OrSSLHandshakeException;
|
||||
import org.jclouds.aws.s3.functions.ReturnTrueIfBucketAlreadyOwnedByYou;
|
||||
import org.jclouds.aws.s3.functions.ReturnTrueOn404FalseIfNotEmpty;
|
||||
import org.jclouds.aws.s3.options.CopyObjectOptions;
|
||||
|
@ -68,7 +69,6 @@ import org.jclouds.blobstore.functions.ReturnVoidOnNotFoundOr404;
|
|||
import org.jclouds.blobstore.functions.ThrowContainerNotFoundOn404;
|
||||
import org.jclouds.blobstore.functions.ThrowKeyNotFoundOn404;
|
||||
import org.jclouds.http.functions.ParseETagHeader;
|
||||
import org.jclouds.http.functions.ReturnFalseOn404;
|
||||
import org.jclouds.http.options.GetOptions;
|
||||
import org.jclouds.rest.annotations.BinderParam;
|
||||
import org.jclouds.rest.annotations.Endpoint;
|
||||
|
@ -169,7 +169,7 @@ public interface S3AsyncClient {
|
|||
@HEAD
|
||||
@Path("/")
|
||||
@QueryParams(keys = "max-keys", values = "0")
|
||||
@ExceptionParser(ReturnFalseOn404.class)
|
||||
@ExceptionParser(ReturnFalseOn404OrSSLHandshakeException.class)
|
||||
Future<Boolean> bucketExists(@HostPrefixParam String bucketName);
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,6 +38,7 @@ import org.jclouds.aws.s3.domain.AccessControlList.Permission;
|
|||
import org.jclouds.aws.s3.filters.RequestAuthorizeSignature;
|
||||
import org.jclouds.aws.s3.functions.ParseObjectFromHeadersAndHttpContent;
|
||||
import org.jclouds.aws.s3.functions.ParseObjectMetadataFromHeaders;
|
||||
import org.jclouds.aws.s3.functions.ReturnFalseOn404OrSSLHandshakeException;
|
||||
import org.jclouds.aws.s3.functions.ReturnTrueIfBucketAlreadyOwnedByYou;
|
||||
import org.jclouds.aws.s3.functions.ReturnTrueOn404FalseIfNotEmpty;
|
||||
import org.jclouds.aws.s3.options.CopyObjectOptions;
|
||||
|
@ -61,7 +62,6 @@ import org.jclouds.blobstore.reference.BlobStoreConstants;
|
|||
import org.jclouds.date.TimeStamp;
|
||||
import org.jclouds.http.functions.ParseETagHeader;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReturnFalseOn404;
|
||||
import org.jclouds.http.functions.ReturnTrueIf2xx;
|
||||
import org.jclouds.http.functions.ReturnVoidIf2xx;
|
||||
import org.jclouds.http.options.GetOptions;
|
||||
|
@ -185,7 +185,7 @@ public class S3AsyncClientTest extends RestClientTest<S3AsyncClient> {
|
|||
|
||||
assertResponseParserClassEquals(method, httpMethod, ReturnTrueIf2xx.class);
|
||||
assertSaxResponseParserClassEquals(method, null);
|
||||
assertExceptionParserClassEquals(method, ReturnFalseOn404.class);
|
||||
assertExceptionParserClassEquals(method, ReturnFalseOn404OrSSLHandshakeException.class);
|
||||
|
||||
checkFilters(httpMethod);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class S3TestInitializer extends BaseTestInitializer<S3AsyncClient, S3Clie
|
|||
protected BlobStoreContext<S3AsyncClient, S3Client> createLiveContext(
|
||||
Module configurationModule, String url, String app, String account, String key) {
|
||||
BaseBlobStoreIntegrationTest.SANITY_CHECK_RETURNED_BUCKET_NAME = true;
|
||||
return new S3BlobStoreContextBuilder(new S3PropertiesBuilder(account, key).relaxSSLHostname()
|
||||
return new S3BlobStoreContextBuilder(new S3PropertiesBuilder(account, key)
|
||||
.build()).withModules(configurationModule, new Log4JLoggingModule()).buildContext();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package org.jclouds.aws.s3.functions;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
import javax.net.ssl.SSLHandshakeException;
|
||||
|
||||
import org.jclouds.http.functions.ReturnFalseOn404;
|
||||
|
||||
/**
|
||||
* S3 buckets are dns names. When we attempt to resolve them, it could throw a misleading
|
||||
* SSLHandshakeException when the bucket isn't found.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Singleton
|
||||
public class ReturnFalseOn404OrSSLHandshakeException extends ReturnFalseOn404 {
|
||||
|
||||
public Boolean apply(Exception from) {
|
||||
Boolean returnVal = super.apply(from);
|
||||
if (returnVal == null && from instanceof SSLHandshakeException) {
|
||||
return false;
|
||||
}
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue