Skip to content

Commit

Permalink
fix: Fix errors in the example code in README.md (#1306)
Browse files Browse the repository at this point in the history
* Fix errors in the example code

There are two small errors in the example that cause compile errors:
- `.stream` instead of `.stream()`
- `data.getBytes` instead of `plaintext.getBytes`

* fix: example code in README

Co-authored-by: Andreas Marek <andimarek@fastmail.fm>
  • Loading branch information
ajewellamz and andimarek authored Jan 9, 2023
1 parent cd08a3b commit b3f5b00
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ public class StringExample {

// The AWS Encryption SDK may add information to the encryption context, so check to
// ensure all of the values that you specified when encrypting are *included* in the returned encryption context.
if (!context.entrySet().stream
if (!context.entrySet().stream()
.allMatch( e -> e.getValue().equals(decryptResult.getEncryptionContext().get(e.getKey())))) {
throw new IllegalStateException("Wrong Encryption Context!");
}

assert Arrays.equals(decryptResult.getResult(), data.getBytes(StandardCharsets.UTF_8));
assert Arrays.equals(decryptResult.getResult(), plaintext.getBytes(StandardCharsets.UTF_8));

// The data is correct, so return it.
System.out.println("Decrypted: " + new String(decryptResult.getResult(), StandardCharsets.UTF_8));
Expand Down

0 comments on commit b3f5b00

Please sign in to comment.