You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2021/08/25 17:28:24 UTC

[GitHub] [solr] athrog commented on a change in pull request #271: SOLR-15599: Upgrade aws sdk

athrog commented on a change in pull request #271:
URL: https://github.com/apache/solr/pull/271#discussion_r695965067



##########
File path: solr/contrib/s3-repository/src/java/org/apache/solr/s3/S3StorageClient.java
##########
@@ -129,17 +139,17 @@ void createDirectory(String path) throws S3Exception {
       //            throw new S3Exception("Parent directory doesn't exist, path=" + path);
     }
 
-    ObjectMetadata objectMetadata = new ObjectMetadata();
-    objectMetadata.setContentType(S3_DIR_CONTENT_TYPE);
-    objectMetadata.setContentLength(0);
-
-    // Create empty object with header
-    final InputStream im = ClosedInputStream.CLOSED_INPUT_STREAM;
-
     try {
-      PutObjectRequest putRequest = new PutObjectRequest(bucketName, path, im, objectMetadata);
-      s3Client.putObject(putRequest);
-    } catch (AmazonClientException ase) {
+      // Create empty object with content type header
+      PutObjectRequest putRequest =
+          PutObjectRequest.builder()
+              .bucket(bucketName)
+              .contentType(S3_DIR_CONTENT_TYPE)
+              .key(path)
+              .build();
+      s3Client.putObject(
+          putRequest, RequestBody.fromInputStream(ClosedInputStream.CLOSED_INPUT_STREAM, 0L));

Review comment:
       Is this CLOSED_INPUT_STREAM still necessary? or can we use `RequestBody.empty()` instead to create an empty object?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org