You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ga...@apache.org on 2020/03/08 13:15:51 UTC
[jclouds] branch master updated: Fix BlobMetadata null size when
using ApacheHCHttp module
This is an automated email from the ASF dual-hosted git repository.
gaul pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jclouds.git
The following commit(s) were added to refs/heads/master by this push:
new d6702e5 Fix BlobMetadata null size when using ApacheHCHttp module
d6702e5 is described below
commit d6702e5ee03f8a3440a7f4d956d7b90fdc527030
Author: Xavier BOURGOUIN <xa...@amadeus.com>
AuthorDate: Thu Jan 16 15:51:58 2020 +0100
Fix BlobMetadata null size when using ApacheHCHttp module
JClouds is apparently exclusively using the Payload object from the HTTP
response to fill in the size of the BlobMetadata (when calling
blobStore.blobMetadata(...) ) - adapt this driver accordingly otherwise
we systematically get null size BlobMetadata out of it.
---
.../http/apachehc/ApacheHCHttpCommandExecutorService.java | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/apachehc/src/main/java/org/jclouds/http/apachehc/ApacheHCHttpCommandExecutorService.java b/drivers/apachehc/src/main/java/org/jclouds/http/apachehc/ApacheHCHttpCommandExecutorService.java
index 57bb2d0..fcc30e8 100644
--- a/drivers/apachehc/src/main/java/org/jclouds/http/apachehc/ApacheHCHttpCommandExecutorService.java
+++ b/drivers/apachehc/src/main/java/org/jclouds/http/apachehc/ApacheHCHttpCommandExecutorService.java
@@ -99,15 +99,20 @@ public class ApacheHCHttpCommandExecutorService extends BaseHttpCommandExecutorS
logger.warn(e, "couldn't receive payload for request: %s", nativeRequest.getRequestLine());
throw e;
}
+ } else {
+ // still create a payload object on no entity responses (ex: to HEAD requests) as this is apparently where JClouds is
+ // exclusively looking for the content metadata (in order to fill in the BlobMetadata with correct size)
+ payload = Payloads.newStringPayload("");
}
+
Multimap<String, String> headers = LinkedHashMultimap.create();
for (Header header : apacheResponse.getAllHeaders()) {
headers.put(header.getName(), header.getValue());
}
- if (payload != null) {
- contentMetadataCodec.fromHeaders(payload.getContentMetadata(), headers);
- headers = filterOutContentHeaders(headers);
- }
+
+ contentMetadataCodec.fromHeaders(payload.getContentMetadata(), headers);
+ headers = filterOutContentHeaders(headers);
+
return HttpResponse.builder().statusCode(apacheResponse.getStatusLine().getStatusCode())
.message(apacheResponse.getStatusLine().getReasonPhrase())
.payload(payload)