5
5
import software .amazon .awssdk .core .client .config .ClientOverrideConfiguration ;
6
6
import software .amazon .awssdk .services .dynamodb .DynamoDbClient ;
7
7
import software .amazon .awssdk .services .dynamodb .model .*;
8
+ import software .amazon .awssdk .services .dynamodb .model .ScanRequest ;
9
+ import software .amazon .awssdk .services .dynamodb .model .ScanResponse ;
8
10
import software .amazon .cryptography .dbencryptionsdk .dynamodb .DynamoDbEncryptionInterceptor ;
9
11
import software .amazon .cryptography .dbencryptionsdk .dynamodb .model .DynamoDbTableEncryptionConfig ;
10
12
import software .amazon .cryptography .dbencryptionsdk .dynamodb .model .DynamoDbTablesEncryptionConfig ;
13
+ import software .amazon .cryptography .dbencryptionsdk .dynamodb .transforms .model .CollectionOfErrors ;
11
14
import software .amazon .cryptography .dbencryptionsdk .structuredencryption .model .CryptoAction ;
12
15
import software .amazon .cryptography .materialproviders .IKeyring ;
13
16
import software .amazon .cryptography .materialproviders .MaterialProviders ;
14
17
import software .amazon .cryptography .materialproviders .model .CreateAwsKmsMrkMultiKeyringInput ;
15
18
import software .amazon .cryptography .materialproviders .model .DBEAlgorithmSuiteId ;
16
19
import software .amazon .cryptography .materialproviders .model .MaterialProvidersConfig ;
17
- import software .amazon .awssdk .services .dynamodb .model .ScanRequest ;
18
- import software .amazon .awssdk .services .dynamodb .model .ScanResponse ;
19
- import software .amazon .cryptography .dbencryptionsdk .dynamodb .transforms .model .CollectionOfErrors ;
20
20
21
21
/*
22
22
This example sets up DynamoDb Encryption for the AWS SDK client
@@ -139,7 +139,7 @@ public static void ScanError(String kmsKeyId, String ddbTableName) {
139
139
)
140
140
.build ();
141
141
142
- // 7. Perform a Scan for which some records will not decrypt
142
+ // 7. Perform a Scan for which some records will not decrypt
143
143
Map <String , AttributeValue > expressionAttributeValues = new HashMap <>();
144
144
expressionAttributeValues .put (
145
145
":prefix" ,
@@ -153,32 +153,16 @@ public static void ScanError(String kmsKeyId, String ddbTableName) {
153
153
.expressionAttributeValues (expressionAttributeValues )
154
154
.build ();
155
155
156
- try
157
- {
158
- final ScanResponse scanResponse = ddb .scan (scanRequest );
159
- }
160
- // catch (DynamoDbEncryptionException e)
161
- // {
162
- // System.err.println("Encryptor Error : " + e.Message);
163
- // }
164
- catch (CollectionOfErrors e )
165
- {
166
- System .err .println ("Decryption Errors : " );
167
- System .err .println (e .message ());
168
- for (Exception element : e .list ())
169
- {
170
- System .err .println (element );
171
- }
172
- }
173
- catch (Exception e )
174
- {
175
- System .err .println ("Other Error : " );
176
- System .err .println (e );
177
- System .err .println (e .getMessage ());
178
- System .err .println (e .getCause ());
179
- System .err .println (((CollectionOfErrors ) e .getCause ()).list ());
180
- }
156
+ try {
157
+ final ScanResponse scanResponse = ddb .scan (scanRequest );
158
+ } catch (Exception e ) {
159
+ System .err .println ("Other Error : " );
160
+ System .err .println (e );
161
+ System .err .println (e .getMessage ());
162
+ System .err .println (e .getCause ());
163
+ System .err .println (((CollectionOfErrors ) e .getCause ()).list ());
181
164
}
165
+ }
182
166
183
167
public static void main (final String [] args ) {
184
168
if (args .length < 2 ) {
0 commit comments