Skip to content

Commit 1b1e3b4

Browse files
committed
Address feedback
1 parent 78aa631 commit 1b1e3b4

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

services/s3/src/main/java/software/amazon/awssdk/services/s3/internal/multipart/UploadWithUnknownContentLengthHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public void onNext(CloseableAsyncRequestBody asyncRequestBody) {
167167
NullPointerException exception = new NullPointerException("asyncRequestBody passed to onNext MUST NOT be null.");
168168
multipartUploadHelper.failRequestsElegantly(futures,
169169
exception, uploadId, returnFuture, putObjectRequest);
170-
return;
170+
throw exception;
171171
}
172172

173173
if (isDone) {

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package software.amazon.awssdk.services.s3.internal.multipart;
1717

1818
import static org.assertj.core.api.Assertions.assertThat;
19+
import static org.assertj.core.api.Assertions.assertThatThrownBy;
1920
import static org.mockito.ArgumentMatchers.any;
2021
import static org.mockito.ArgumentMatchers.eq;
2122
import static org.mockito.Mockito.mock;
@@ -164,7 +165,8 @@ void uploadObject_nullAsyncRequestBody_shouldFailRequest() {
164165

165166
Subscription subscription = mock(Subscription.class);
166167
subscriber.onSubscribe(subscription);
167-
subscriber.onNext(null);
168+
assertThatThrownBy(() -> subscriber.onNext(null)).isInstanceOf(NullPointerException.class).hasMessageContaining(
169+
"asyncRequestBody");
168170

169171
assertThat(future).isCompletedExceptionally();
170172
future.exceptionally(throwable -> {

0 commit comments

Comments
 (0)