Skip to content

Commit eb99084

Browse files
committed
Merge pull request #1 from scode/master
Avoid spurious warning when uploading empty file using an InputStream.
2 parents 570c895 + c0bbbf7 commit eb99084

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/com/amazonaws/services/s3/AmazonS3Client.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,8 @@ public PutObjectResult putObject(PutObjectRequest putObjectRequest)
944944
request.addHeader(Headers.STORAGE_CLASS, putObjectRequest.getStorageClass());
945945
}
946946

947-
if (metadata.getContentLength() <= 0) {
947+
// Use internal interface to differentiate 0 from unset.
948+
if (metadata.getRawMetadata().get(Headers.CONTENT_LENGTH) == null) {
948949
/*
949950
* There's nothing we can do except for let the HTTP client buffer
950951
* the input stream contents if the caller doesn't tell us how much

0 commit comments

Comments
 (0)