File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
src/main/java/software/amazon/encryption/s3 Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -666,11 +666,7 @@ public Builder rsaKeyPair(PartialRsaKeyPair partialRsaKeyPair) {
666666 * @return Returns a reference to this object so that method calls can be chained together.
667667 */
668668 public Builder kmsKeyId (String kmsKeyId ) {
669- try {
670- Class .forName ("software.amazon.awssdk.services.kms.KmsClient" );
671- } catch (ClassNotFoundException e ) {
672- throw new RuntimeException ("software.amazon.awssdk:kms is required to set up with KMS key" , e );
673- }
669+ this ._kmsKeyId = kmsKeyId ;
674670 checkKeyOptions ();
675671
676672 return this ;
@@ -1143,6 +1139,11 @@ public S3EncryptionClient build() {
11431139 .secureRandom (_secureRandom )
11441140 .build ();
11451141 } else if (_kmsKeyId != null ) {
1142+ try {
1143+ Class .forName ("software.amazon.awssdk.services.kms.KmsClient" );
1144+ } catch (ClassNotFoundException e ) {
1145+ throw new RuntimeException ("software.amazon.awssdk:kms is required to set up with KMS key" , e );
1146+ }
11461147 KmsClient kmsClient = KmsClient .builder ()
11471148 .credentialsProvider (_awsCredentialsProvider )
11481149 .region (_region )
You can’t perform that action at this time.
0 commit comments