Skip to content

Commit 3623455

Browse files
committed
Review comments
1 parent 2d47644 commit 3623455

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/http-auth-aws/src/main/java/software/amazon/awssdk/http/auth/aws/internal/signer/chunkedencoding/ChunkedEncodedPublisher.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ private ByteBuffer encodeChunk(ByteBuffer byteBuffer) {
152152
trailerData = Collections.emptyList();
153153
}
154154

155-
//
156155
int trailerLen = trailerData.stream()
157156
// + 2 for each CRLF that ends the header-field
158157
.mapToInt(t -> t.remaining() + 2)
@@ -220,6 +219,11 @@ private List<ByteBuffer> getTrailerData() {
220219
List<byte[]> values = trailer.right()
221220
.stream().map(v -> v.getBytes(StandardCharsets.UTF_8))
222221
.collect(Collectors.toList());
222+
223+
if (values.isEmpty()) {
224+
throw new RuntimeException(String.format("Trailing header '%s' has no values", trailer.left()));
225+
}
226+
223227
int valuesLen = values.stream().mapToInt(v -> v.length).sum();
224228
// name:value1,value2,..
225229
int size = key.length

0 commit comments

Comments
 (0)