Ka-Hing Cheung created JCLOUDS-957: -------------------------------------- Summary: openstack-swift provider throws different exceptions for copyBlob Key: JCLOUDS-957 URL: https://issues.apache.org/jira/browse/JCLOUDS-957 Project: jclouds Issue Type: Bug Components: jclouds-blobstore Reporter: Ka-Hing Cheung
S3 and LocalBlobStore both throw KeyNotFoundException if copyBlob is called with an non-existent source key, but openstack-swift throws different exceptions depends on how copyBlob is used. <code> @Test(groups = { "integration", "live" }) public void testCopy404Blob() throws Exception { BlobStore blobStore = view.getBlobStore(); String container = getContainerName(); try { blobStore.copyBlob(container, "blob", container, "blob2", CopyOptions.NONE); } catch (KeyNotFoundException e) { } finally { returnContainer(container); } } @Test(groups = { "integration", "live" }) public void testCopy404BlobMeta() throws Exception { BlobStore blobStore = view.getBlobStore(); String container = getContainerName(); try { blobStore.copyBlob(container, "blob", container, "blob2", CopyOptions.builder().userMetadata(ImmutableMap.of("x", "1")).build()); } catch (KeyNotFoundException e) { } finally { returnContainer(container); } } <code> The first test throws NullPointerException: <code> java.lang.NullPointerException: null at org.jclouds.openstack.swift.v1.blobstore.RegionScopedSwiftBlobStore.copyBlob(RegionScopedSwiftBlobStore.java:287) at org.jclouds.blobstore.integration.internal.BaseBlobIntegrationTest.testCopy404Blob(BaseBlobIntegrationTest.java:992) <code> whereas the latter throws a swift specific exception: <code> org.jclouds.openstack.swift.v1.CopyObjectException: Either the source path '/khc-blobstore0/blob' or the destination path '/khc-blobstore0/blob2' was not found. (message: <html><h1>Not Found</h1><p>The resource could not be found.</p></html>) at org.jclouds.openstack.swift.v1.handlers.SwiftErrorHandler.handleError(SwiftErrorHandler.java:64) at org.jclouds.http.handlers.DelegatingErrorHandler.handleError(DelegatingErrorHandler.java:65) at org.jclouds.http.internal.BaseHttpCommandExecutorService.shouldContinue(BaseHttpCommandExecutorService.java:136) at org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:105) at org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:90) at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:73) at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:44) at org.jclouds.reflect.FunctionalReflection$FunctionalInvocationHandler.handleInvocation(FunctionalReflection.java:117) at com.google.common.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:87) at com.sun.proxy.$Proxy73.copy(Unknown Source) at org.jclouds.openstack.swift.v1.blobstore.RegionScopedSwiftBlobStore.copyBlob(RegionScopedSwiftBlobStore.java:307) at org.jclouds.blobstore.integration.internal.BaseBlobIntegrationTest.testCopy404BlobMeta(BaseBlobIntegrationTest.java:1004) <code> -- This message was sent by Atlassian JIRA (v6.3.4#6332)