Skip to content

Commit 0fac917

Browse files
authored
Merge pull request #3649 from aws/zoewang/addressFeedback
Minor fixes to address feedback and update changelog file
2 parents 47dd955 + bf3383d commit 0fac917

File tree

6 files changed

+26
-20
lines changed

6 files changed

+26
-20
lines changed

.changes/2.30.17.json

+18
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,24 @@
1414
"contributor": "",
1515
"description": "Remove unnecessary invocation of `ContentStreamProvider#newStream` when content-length is known for requests that use AWS chunked encoding."
1616
},
17+
{
18+
"type": "feature",
19+
"category": "AWS SDK for Java v2",
20+
"contributor": "",
21+
"description": "The SDK now does not buffer input data from `RequestBody#fromInputStream` in cases where the InputStream does not support mark and reset."
22+
},
23+
{
24+
"type": "feature",
25+
"category": "AWS SDK for Java v2",
26+
"contributor": "",
27+
"description": "The SDK now throws exception for input streaming operation if the stream has fewer bytes (i.e. reaches EOF) before the expected length is reached."
28+
},
29+
{
30+
"type": "feature",
31+
"category": "AWS SDK for Java v2",
32+
"contributor": "",
33+
"description": "The SDK now does not buffer input data from ContentStreamProvider in cases where content length is known."
34+
},
1735
{
1836
"type": "feature",
1937
"category": "AWS Database Migration Service",

.changes/next-release/feature-AWSSDKforJavav2-02883e2.json

-6
This file was deleted.

.changes/next-release/feature-AWSSDKforJavav2-9dffbaf.json

-6
This file was deleted.

.changes/next-release/feature-AWSSDKforJavav2-ee5927f.json

-6
This file was deleted.

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
## __AWS SDK for Java v2__
1212
- ### Features
1313
- Updated endpoint and partition metadata.
14+
- The SDK now does not buffer input data from `RequestBody#fromInputStream` in cases where the InputStream does not support mark and reset.
15+
- The SDK now throws exception for input streaming operation if the stream has fewer bytes (i.e. reaches EOF) before the expected length is reached.
16+
- The SDK now does not buffer input data from ContentStreamProvider in cases where content length is known.
1417

1518
- ### Bugfixes
1619
- Remove unnecessary invocation of `ContentStreamProvider#newStream` when content-length is known for requests that use AWS chunked encoding.

core/sdk-core/src/main/java/software/amazon/awssdk/core/internal/io/SdkLengthAwareInputStream.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ public int read() throws IOException {
5252

5353
if (read != -1) {
5454
remaining--;
55-
} else if (remaining != 0) { // EOF, ensure we've read the number of expected bytes
55+
}
56+
57+
// EOF, ensure we've read the number of expected bytes
58+
if (read == -1 && remaining > 0) {
5659
throw new IllegalStateException("The request content has fewer bytes than the "
5760
+ "specified "
5861
+ "content-length: " + length + " bytes.");
@@ -75,7 +78,7 @@ public int read(byte[] b, int off, int len) throws IOException {
7578
}
7679

7780
// EOF, ensure we've read the number of expected bytes
78-
if (read == -1 && remaining != 0) {
81+
if (read == -1 && remaining > 0) {
7982
throw new IllegalStateException("The request content has fewer bytes than the "
8083
+ "specified "
8184
+ "content-length: " + length + " bytes.");

0 commit comments

Comments
 (0)