File tree 3 files changed +21
-10
lines changed
services-custom/s3-transfer-manager/src
main/java/software/amazon/awssdk/transfer/s3/internal
test/java/software/amazon/awssdk/transfer/s3/internal
3 files changed +21
-10
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "category" : " S3 Transfer Manager" ,
3
+ "contributor" : " " ,
4
+ "type" : " bugfix" ,
5
+ "description" : " Fix the NPE thrown when calling `S3TransferManager.create()`"
6
+ }
Original file line number Diff line number Diff line change 37
37
public final class DefaultS3TransferManager implements S3TransferManager {
38
38
private final S3CrtAsyncClient s3CrtAsyncClient ;
39
39
40
- public DefaultS3TransferManager (DefaultBuilder builder ) {
40
+ public DefaultS3TransferManager (DefaultBuilder tmBuilder ) {
41
41
S3CrtAsyncClient .S3CrtAsyncClientBuilder clientBuilder = S3CrtAsyncClient .builder ();
42
- builder .s3ClientConfiguration .credentialsProvider ().ifPresent (clientBuilder ::credentialsProvider );
43
- builder .s3ClientConfiguration .maxConcurrency ().ifPresent (clientBuilder ::maxConcurrency );
44
- builder .s3ClientConfiguration .minimumPartSizeInBytes ().ifPresent (clientBuilder ::minimumPartSizeInBytes );
45
- builder .s3ClientConfiguration .region ().ifPresent (clientBuilder ::region );
46
- builder .s3ClientConfiguration .targetThroughputInGbps ().ifPresent (clientBuilder ::targetThroughputInGbps );
47
- builder .s3ClientConfiguration .asyncConfiguration ().ifPresent (clientBuilder ::asyncConfiguration );
42
+ if (tmBuilder .s3ClientConfiguration != null ) {
43
+ tmBuilder .s3ClientConfiguration .credentialsProvider ().ifPresent (clientBuilder ::credentialsProvider );
44
+ tmBuilder .s3ClientConfiguration .maxConcurrency ().ifPresent (clientBuilder ::maxConcurrency );
45
+ tmBuilder .s3ClientConfiguration .minimumPartSizeInBytes ().ifPresent (clientBuilder ::minimumPartSizeInBytes );
46
+ tmBuilder .s3ClientConfiguration .region ().ifPresent (clientBuilder ::region );
47
+ tmBuilder .s3ClientConfiguration .targetThroughputInGbps ().ifPresent (clientBuilder ::targetThroughputInGbps );
48
+ tmBuilder .s3ClientConfiguration .asyncConfiguration ().ifPresent (clientBuilder ::asyncConfiguration );
49
+ }
48
50
49
51
s3CrtAsyncClient = clientBuilder .build ();
50
52
}
Original file line number Diff line number Diff line change @@ -42,9 +42,6 @@ public class S3TransferManagerTest {
42
42
private S3CrtAsyncClient mockS3Crt ;
43
43
private S3TransferManager tm ;
44
44
45
- @ Rule
46
- public ExpectedException thrown = ExpectedException .none ();
47
-
48
45
@ Before
49
46
public void methodSetup () {
50
47
mockS3Crt = mock (S3CrtAsyncClient .class );
@@ -56,6 +53,12 @@ public void methodTeardown() {
56
53
tm .close ();
57
54
}
58
55
56
+ @ Test
57
+ public void defaultTransferManager_shouldNotThrowException () {
58
+ S3TransferManager transferManager = S3TransferManager .create ();
59
+ transferManager .close ();
60
+ }
61
+
59
62
@ Test
60
63
public void upload_returnsResponse () {
61
64
PutObjectResponse response = PutObjectResponse .builder ().build ();
You can’t perform that action at this time.
0 commit comments