This is an automated email from the ASF dual-hosted git repository. oalsafi pushed a commit to branch camel-3.4.x in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.4.x by this push: new 9f21026 CAMEL-15436: Ignore appendBlob and pageBlob creation if they exist 9f21026 is described below commit 9f210265a69e47dcace223a6f7773f73962444b9 Author: Omar Al-Safi <omars...@gmail.com> AuthorDate: Fri Aug 21 11:30:11 2020 +0200 CAMEL-15436: Ignore appendBlob and pageBlob creation if they exist --- .../component/azure/storage/blob/client/BlobClientWrapper.java | 8 ++++++++ .../component/azure/storage/blob/operations/BlobOperations.java | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/components/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/client/BlobClientWrapper.java b/components/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/client/BlobClientWrapper.java index b417dc0..f619208 100644 --- a/components/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/client/BlobClientWrapper.java +++ b/components/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/client/BlobClientWrapper.java @@ -132,6 +132,10 @@ public class BlobClientWrapper { return getAppendBlobClient().appendBlockWithResponse(data, length, contentMd5, appendBlobRequestConditions, timeout, Context.NONE); } + public boolean appendBlobExists() { + return getAppendBlobClient().exists(); + } + public Response<PageBlobItem> createPageBlob(final long size, final Long sequenceNumber, final BlobHttpHeaders headers, final Map<String, String> metadata, final BlobRequestConditions requestConditions, final Duration timeout) { return getPageBlobClient().createWithResponse(size, sequenceNumber, headers, metadata, requestConditions, timeout, Context.NONE); @@ -155,6 +159,10 @@ public class BlobClientWrapper { return getPageBlobClient().getPageRangesWithResponse(blobRange, requestConditions, timeout, Context.NONE); } + public boolean pageBlobExists() { + return getPageBlobClient().exists(); + } + public String generateSas(final BlobServiceSasSignatureValues blobServiceSasSignatureValues) { return client.generateSas(blobServiceSasSignatureValues); } diff --git a/components/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/operations/BlobOperations.java b/components/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/operations/BlobOperations.java index 3bc4ee8..5160865 100644 --- a/components/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/operations/BlobOperations.java +++ b/components/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/operations/BlobOperations.java @@ -319,7 +319,8 @@ public class BlobOperations { final BlobCommonRequestOptions commonRequestOptions = BlobUtils.getCommonRequestOptions(exchange); final boolean createAppendBlob = BlobExchangeHeaders.getCreateAppendBlobFlagFromHeaders(exchange); - if (createAppendBlob) { + // only if header is true and we don't have one exists + if (createAppendBlob && !client.appendBlobExists()) { createAppendBlob(exchange); } @@ -358,7 +359,8 @@ public class BlobOperations { final boolean createPageBlob = BlobExchangeHeaders.getCreatePageBlobFlagFromHeaders(exchange); - if (createPageBlob) { + // only if header is true and we don't have one exists + if (createPageBlob && !client.pageBlobExists()) { createPageBlob(exchange); }