We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent de4ff9c commit f108896Copy full SHA for f108896
src/main/java/com/amazonaws/encryptionsdk/MasterKeyProvider.java
@@ -102,10 +102,13 @@ protected AwsCryptoException buildCannotDecryptDksException(List<? extends Throw
102
if (t == null || t.isEmpty()) {
103
return new CannotUnwrapDataKeyException("Unable to decrypt any data keys");
104
} else {
105
- final CannotUnwrapDataKeyException ex = new CannotUnwrapDataKeyException("Unable to decrypt any data keys",
106
- t.get(0));
+ CannotUnwrapDataKeyException ex = null;
107
for (final Throwable e : t) {
108
- ex.addSuppressed(e);
+ if (ex == null) {
+ ex = new CannotUnwrapDataKeyException("Unable to decrypt any data keys", e);
109
+ } else {
110
+ ex.addSuppressed(e);
111
+ }
112
}
113
return ex;
114
0 commit comments