Updated Branches: refs/heads/object_store 03f4c6036 -> 1d6ed8ac2
A hack to handle RiakCS bug in generating ETAG for multi-part upload object. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1d6ed8ac Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1d6ed8ac Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1d6ed8ac Branch: refs/heads/object_store Commit: 1d6ed8ac20bd89625a3fb7f16c4e8d0d5f59ed90 Parents: 03f4c60 Author: Min Chen <min.c...@citrix.com> Authored: Fri Jun 7 16:00:19 2013 -0700 Committer: Min Chen <min.c...@citrix.com> Committed: Fri Jun 7 16:00:19 2013 -0700 ---------------------------------------------------------------------- utils/src/com/cloud/utils/S3Utils.java | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1d6ed8ac/utils/src/com/cloud/utils/S3Utils.java ---------------------------------------------------------------------- diff --git a/utils/src/com/cloud/utils/S3Utils.java b/utils/src/com/cloud/utils/S3Utils.java index f195215..e7817f5 100644 --- a/utils/src/com/cloud/utils/S3Utils.java +++ b/utils/src/com/cloud/utils/S3Utils.java @@ -222,8 +222,15 @@ public final class S3Utils { key, bucketName, tempFile.getName())); } - connection.getObject(new GetObjectRequest(bucketName, key), - tempFile); + try { + connection.getObject(new GetObjectRequest(bucketName, key), tempFile); + } catch (AmazonClientException ex) { + // hack to handle different ETAG format generated from RiakCS for multi-part uploaded object + String msg = ex.getMessage(); + if (!msg.contains("verify integrity")){ + throw ex; + } + } final File targetFile = new File(targetDirectory, namingStrategy.determineFileName(key)); @@ -245,7 +252,8 @@ public final class S3Utils { targetDirectory.getAbsolutePath(), bucketName, key), e); - } finally { + } + finally { if (tempFile != null) { tempFile.delete();