[
https://issues.apache.org/jira/browse/JCLOUDS-1487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andrew Gaul updated JCLOUDS-1487:
---------------------------------
Description:
Content length is mandatory while uploading to Azure using JClouds portable
Blob Store API
{code:java}
Blob blob = blobStore.blobBuilder(blobName)
.payload(new InputStreamPayload(inputStream))
.contentType(contentType)
.build();
blobStore.putBlob(container, blob);
{code}
[BindAzureBlobMetadataToRequest|https://github.com/fusesource/jclouds/blame/master/providers/azureblob/src/main/java/org/jclouds/azureblob/binders/BindAzureBlobMetadataToRequest.java]
class checks that content length is specified and is greater than zero in
lines 58-59. However, according to the Azure SDK documentation, Azure
[CloudBlockBlob|https://azure.github.io/azure-sdk-for-java/com/microsoft/azure/storage/blob/CloudBlockBlob.html#upload-java.io.InputStream-long-]
also accepts -1 if content length is unknown:
{{length}} - A {{long}} which represents the length, in bytes, of the stream
data, or -1 if unknown.
We have a use case when we need to stream a big chunk of data of unknown size
directly into a cloud storage. Portable JClouds API allows to upload files into
OpenStack SWIFT without specifying their size, but it fails on Azure.
was:
Content length is mandatory while uploading to Azure using JClouds portable
Blob Store API
Code example:
Blob blob = blobStore.blobBuilder(blobName)
.payload(new InputStreamPayload(inputStream))
.contentType(contentType)
.build();
blobStore.putBlob(container, blob);
[BindAzureBlobMetadataToRequest|https://github.com/fusesource/jclouds/blame/master/providers/azureblob/src/main/java/org/jclouds/azureblob/binders/BindAzureBlobMetadataToRequest.java]
class checks that content length is specified and is greater than zero in
lines 58-59. However, according to the Azure SDK documentation, Azure
[CloudBlockBlob|https://azure.github.io/azure-sdk-for-java/com/microsoft/azure/storage/blob/CloudBlockBlob.html#upload-java.io.InputStream-long-]
also accepts -1 if content length is unknown:
{{length}} - A {{long}} which represents the length, in bytes, of the stream
data, or -1 if unknown.
We have a use case when we need to stream a big chunk of data of unknown size
directly into a cloud storage. Portable JClouds API allows to upload files into
OpenStack SWIFT without specifying their size, but it fails on Azure.
> Blob content length is mandatory while uploading to Azure
> ---------------------------------------------------------
>
> Key: JCLOUDS-1487
> URL: https://issues.apache.org/jira/browse/JCLOUDS-1487
> Project: jclouds
> Issue Type: Bug
> Components: jclouds-blobstore
> Affects Versions: 2.1.1
> Reporter: Alexander Chernavin
> Priority: Major
> Labels: azureblob
> Attachments: length_exception.txt
>
>
> Content length is mandatory while uploading to Azure using JClouds portable
> Blob Store API
> {code:java}
> Blob blob = blobStore.blobBuilder(blobName)
> .payload(new InputStreamPayload(inputStream))
> .contentType(contentType)
> .build();
> blobStore.putBlob(container, blob);
> {code}
> [BindAzureBlobMetadataToRequest|https://github.com/fusesource/jclouds/blame/master/providers/azureblob/src/main/java/org/jclouds/azureblob/binders/BindAzureBlobMetadataToRequest.java]
> class checks that content length is specified and is greater than zero in
> lines 58-59. However, according to the Azure SDK documentation, Azure
> [CloudBlockBlob|https://azure.github.io/azure-sdk-for-java/com/microsoft/azure/storage/blob/CloudBlockBlob.html#upload-java.io.InputStream-long-]
> also accepts -1 if content length is unknown:
> {{length}} - A {{long}} which represents the length, in bytes, of the stream
> data, or -1 if unknown.
>
> We have a use case when we need to stream a big chunk of data of unknown size
> directly into a cloud storage. Portable JClouds API allows to upload files
> into OpenStack SWIFT without specifying their size, but it fails on Azure.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)