Skip to content

Commit b9a976b

Browse files
committed
improve style
1 parent ca80bba commit b9a976b

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/main/java/software/amazon/encryption/s3/internal/ContentMetadataDecodingStrategy.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,8 @@ private ContentMetadata readFromMap(Map<String, String> metadata, GetObjectRespo
138138

139139
// Get encrypted data key encryption context
140140
final Map<String, String> encryptionContext = new HashMap<>();
141-
String jsonEncryptionContext = metadata.get(MetadataKeyConstants.ENCRYPTED_DATA_KEY_CONTEXT);
142-
if (jsonEncryptionContext == null) {
143-
// The V2 client treats null value here as empty, do the same to avoid incompatibility
144-
jsonEncryptionContext = "{}";
145-
}
141+
// The V2 client treats null value here as empty, do the same to avoid incompatibility
142+
String jsonEncryptionContext = metadata.getOrDefault(MetadataKeyConstants.ENCRYPTED_DATA_KEY_CONTEXT, "{}");
146143
// When the encryption context contains non-US-ASCII characters,
147144
// the S3 server applies an esoteric encoding to the object metadata.
148145
// Reverse that, to allow decryption.

0 commit comments

Comments
 (0)