This is an automated email from the ASF dual-hosted git repository.
gaul pushed a commit to branch 2.2.x
in repository https://gitbox.apache.org/repos/asf/jclouds.git
The following commit(s) were added to refs/heads/2.2.x by this push:
new 94f0285 Fix BlobMetadata null size when using ApacheHCHttp module
94f0285 is described below
commit 94f02856b7a9c891e63c2e7296d6ce00c70a43a3
Author: Xavier BOURGOUIN <[email protected]>
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)