Skip to content

Commit f2aded0

Browse files
committed
S3MH: use AsyncRequestBody.fromFile()
Related to the fix for the aws/aws-sdk-java-v2#3839
1 parent cd52fed commit f2aded0

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/main/java/org/springframework/integration/aws/outbound/S3MessageHandler.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2023 the original author or authors.
2+
* Copyright 2016-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,7 +22,6 @@
2222
import java.util.concurrent.CompletionException;
2323
import java.util.function.BiConsumer;
2424

25-
import org.apache.commons.io.FileUtils;
2625
import software.amazon.awssdk.core.async.AsyncRequestBody;
2726
import software.amazon.awssdk.core.internal.util.Mimetype;
2827
import software.amazon.awssdk.services.s3.S3AsyncClient;
@@ -311,8 +310,7 @@ else if (payload instanceof File fileToUpload) {
311310
if (putObjectRequest.contentType() == null) {
312311
putObjectRequestBuilder.contentType(Mimetype.getInstance().getMimetype(fileToUpload));
313312
}
314-
// TODO until https://github.com/aws/aws-sdk-java-v2/issues/3839
315-
requestBody = AsyncRequestBody.fromBytes(FileUtils.readFileToByteArray(fileToUpload));
313+
requestBody = AsyncRequestBody.fromFile(fileToUpload);
316314
}
317315
else if (payload instanceof byte[] payloadBytes) {
318316
if (putObjectRequest.contentMD5() == null) {

0 commit comments

Comments
 (0)