Skip to content

Commit 4a8d6e2

Browse files
committed
Address comments
1 parent 4a927cb commit 4a8d6e2

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

core/sdk-core/src/main/java/software/amazon/awssdk/core/internal/async/ByteArraySplittingTransformer.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,12 @@ private void handleSubscriptionCancel() {
165165
return;
166166
}
167167

168-
CompletableFuture<ResponseBytes<ResponseT>> upstreamPrepareFuture = upstreamResponseTransformer.prepare();
169-
CompletableFutureUtils.forwardResultTo(upstreamPrepareFuture, resultFuture);
168+
try {
169+
CompletableFuture<ResponseBytes<ResponseT>> upstreamPrepareFuture = upstreamResponseTransformer.prepare();
170+
CompletableFutureUtils.forwardResultTo(upstreamPrepareFuture, resultFuture);
170171

171-
upstreamResponseTransformer.onResponse(responseT.get());
172+
upstreamResponseTransformer.onResponse(responseT.get());
172173

173-
try {
174174
buffers.keySet().stream().sorted().forEach(index -> {
175175
publisherToUpstream.send(buffers.get(index)).exceptionally(ex -> {
176176
resultFuture.completeExceptionally(SdkClientException.create("unexpected error occurred", ex));

services/s3/src/main/java/software/amazon/awssdk/services/s3/multipart/MultipartConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ public interface Builder extends CopyableBuilder<Builder, MultipartConfiguration
164164
* <p>
165165
* Default value: If not specified, the SDK will use the equivalent of four parts worth of memory, so 32 Mib by default.
166166
* <p>
167-
* This setting is not supported and will be ignored when downloading to a byte array, i.e., when providing a
168-
* {@link ByteArrayAsyncResponseTransformer}.
167+
* This setting does not apply if you are using an {@link AsyncResponseTransformer} implementation that downloads the
168+
* object into memory such as {@link AsyncResponseTransformer#toBytes}
169169
*
170170
* @param apiCallBufferSizeInBytes the value of the maximum memory usage.
171171
* @return an instance of this builder.

services/s3/src/test/java/software/amazon/awssdk/services/s3/internal/multipart/S3MultipartClientGetObjectWiremockTest.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
import software.amazon.awssdk.core.internal.async.FileAsyncResponseTransformer;
6161
import software.amazon.awssdk.core.internal.async.InputStreamResponseTransformer;
6262
import software.amazon.awssdk.core.internal.async.PublisherAsyncResponseTransformer;
63+
import software.amazon.awssdk.core.internal.async.SplittingTransformer;
6364
import software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient;
6465
import software.amazon.awssdk.regions.Region;
6566
import software.amazon.awssdk.services.s3.S3AsyncClient;
@@ -142,7 +143,7 @@ public <T> void errorOnThirdPart_shouldCompleteExceptionallyOnlyPartsGreaterThan
142143
}
143144

144145
@ParameterizedTest
145-
@MethodSource("responseTransformers")
146+
@MethodSource("nonRetryableResponseTransformers")
146147
public <T> void errorOnFirstPart_shouldFail(AsyncResponseTransformerTestSupplier<T> supplier) {
147148
stubFor(get(urlEqualTo(String.format("/%s/%s?partNumber=1", BUCKET, KEY))).willReturn(
148149
aResponse()
@@ -155,8 +156,8 @@ public <T> void errorOnFirstPart_shouldFail(AsyncResponseTransformerTestSupplier
155156
}
156157

157158
@ParameterizedTest
158-
@MethodSource("responseTransformers")
159-
public <T> void ioError_shouldFailAndNotRetry(AsyncResponseTransformerTestSupplier<T> supplier) {
159+
@MethodSource("nonRetryableResponseTransformers")
160+
public <T> void nonRetryableResponseTransformers_ioErrorOnFirstPart_shouldFailAndNotRetry(AsyncResponseTransformerTestSupplier<T> supplier) {
160161
stubFor(get(urlEqualTo(String.format("/%s/%s?partNumber=1", BUCKET, KEY)))
161162
.willReturn(aResponse()
162163
.withFault(Fault.CONNECTION_RESET_BY_PEER)));
@@ -175,7 +176,7 @@ public <T> void ioError_shouldFailAndNotRetry(AsyncResponseTransformerTestSuppli
175176
}
176177

177178
@ParameterizedTest
178-
@MethodSource("responseTransformers")
179+
@MethodSource("nonRetryableResponseTransformers")
179180
public void getObject_single500WithinMany200s_shouldNotRetryError(AsyncResponseTransformerTestSupplier<?> transformerSupplier) {
180181
List<CompletableFuture<?>> futures = new ArrayList<>();
181182

@@ -243,14 +244,16 @@ private static Stream<Arguments> partSizeAndTransformerParams() {
243244

244245

245246
/**
246-
* Testing {@link PublisherAsyncResponseTransformer}, {@link InputStreamResponseTransformer}, and
247+
* Testing response transformers that are not retryable when
248+
* {@link AsyncResponseTransformer#split(SplittingTransformerConfiguration)} is invoked and used with
249+
* {@link SplittingTransformer} - {@link PublisherAsyncResponseTransformer}, {@link InputStreamResponseTransformer}, and
247250
* {@link FileAsyncResponseTransformer}
248251
* <p>
249252
*
250253
* Retry for multipart download is supported for {@link ByteArrayAsyncResponseTransformer}, tested in
251254
* {@link S3MultipartClientGetObjectRetryBehaviorWiremockTest}.
252255
*/
253-
private static Stream<AsyncResponseTransformerTestSupplier<?>> responseTransformers() {
256+
private static Stream<AsyncResponseTransformerTestSupplier<?>> nonRetryableResponseTransformers() {
254257
return Stream.of(new AsyncResponseTransformerTestSupplier.InputStreamArtSupplier(),
255258
new AsyncResponseTransformerTestSupplier.PublisherArtSupplier(),
256259
new AsyncResponseTransformerTestSupplier.FileArtSupplier());

0 commit comments

Comments
 (0)