From 562b3efbd8b5be54e21dd868dd4a1cb9539ac3a1 Mon Sep 17 00:00:00 2001 From: Tony Knapp <5892063+texastony@users.noreply.github.com> Date: Tue, 26 Nov 2024 09:06:56 -0800 Subject: [PATCH] fix(Java): Improve Collection of Errors string (#1478) --- .gitignore | 3 +++ .../DynamoDbEncryption/java/dafny-4.8.0.patch | 27 +++++++++++++++++++ .../java/dafny-4.8.0.patch | 27 +++++++++++++++++++ .../java/dafny-4.8.0.patch | 27 +++++++++++++++++++ .../java/dafny-4.8.0.patch | 27 +++++++++++++++++++ .../model/CollectionOfErrors.java | 9 +++++++ .../dynamodb/model/CollectionOfErrors.java | 9 +++++++ .../transforms/model/CollectionOfErrors.java | 9 +++++++ .../model/CollectionOfErrors.java | 9 +++++++ 9 files changed, 147 insertions(+) create mode 100644 DynamoDbEncryption/codegen-patches/DynamoDbEncryption/java/dafny-4.8.0.patch create mode 100644 DynamoDbEncryption/codegen-patches/DynamoDbEncryptionTransforms/java/dafny-4.8.0.patch create mode 100644 DynamoDbEncryption/codegen-patches/DynamoDbItemEncryptor/java/dafny-4.8.0.patch create mode 100644 DynamoDbEncryption/codegen-patches/StructuredEncryption/java/dafny-4.8.0.patch diff --git a/.gitignore b/.gitignore index fd0875aed..4c01b8aed 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,6 @@ test/**/Output/* specification_compliance_report.html /compliance /.smithy.lsp.log + +# logs +*.log \ No newline at end of file diff --git a/DynamoDbEncryption/codegen-patches/DynamoDbEncryption/java/dafny-4.8.0.patch b/DynamoDbEncryption/codegen-patches/DynamoDbEncryption/java/dafny-4.8.0.patch new file mode 100644 index 000000000..5916d97ab --- /dev/null +++ b/DynamoDbEncryption/codegen-patches/DynamoDbEncryption/java/dafny-4.8.0.patch @@ -0,0 +1,27 @@ +diff --git b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CollectionOfErrors.java a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CollectionOfErrors.java +index c6f44188..c2af7d32 100644 +--- b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CollectionOfErrors.java ++++ a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CollectionOfErrors.java +@@ -4,6 +4,7 @@ + package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + + import java.util.List; ++import java.util.stream.Collectors; + + public class CollectionOfErrors extends RuntimeException { + +@@ -134,6 +135,14 @@ public class CollectionOfErrors extends RuntimeException { + } + + public CollectionOfErrors build() { ++ if (!(this.list == null || this.list.isEmpty())) { ++ this.message = ++ this.message + ++ " String representation of Exceptions in list.\n" + ++ this.list.stream() ++ .map(ex -> ex.getClass().getSimpleName() + ": " + ex.getMessage()) ++ .collect(Collectors.joining("\n")); ++ } + return new CollectionOfErrors(this); + } + } diff --git a/DynamoDbEncryption/codegen-patches/DynamoDbEncryptionTransforms/java/dafny-4.8.0.patch b/DynamoDbEncryption/codegen-patches/DynamoDbEncryptionTransforms/java/dafny-4.8.0.patch new file mode 100644 index 000000000..88642ebc3 --- /dev/null +++ b/DynamoDbEncryption/codegen-patches/DynamoDbEncryptionTransforms/java/dafny-4.8.0.patch @@ -0,0 +1,27 @@ +diff --git b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/transforms/model/CollectionOfErrors.java a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/transforms/model/CollectionOfErrors.java +index 7a2ca9b0..db01d961 100644 +--- b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/transforms/model/CollectionOfErrors.java ++++ a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/transforms/model/CollectionOfErrors.java +@@ -4,6 +4,7 @@ + package software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.model; + + import java.util.List; ++import java.util.stream.Collectors; + + public class CollectionOfErrors extends RuntimeException { + +@@ -134,6 +135,14 @@ public class CollectionOfErrors extends RuntimeException { + } + + public CollectionOfErrors build() { ++ if (!(this.list == null || this.list.isEmpty())) { ++ this.message = ++ this.message + ++ " String representation of Exceptions in list.\n" + ++ this.list.stream() ++ .map(ex -> ex.getClass().getSimpleName() + ": " + ex.getMessage()) ++ .collect(Collectors.joining("\n")); ++ } + return new CollectionOfErrors(this); + } + } diff --git a/DynamoDbEncryption/codegen-patches/DynamoDbItemEncryptor/java/dafny-4.8.0.patch b/DynamoDbEncryption/codegen-patches/DynamoDbItemEncryptor/java/dafny-4.8.0.patch new file mode 100644 index 000000000..5dc88b460 --- /dev/null +++ b/DynamoDbEncryption/codegen-patches/DynamoDbItemEncryptor/java/dafny-4.8.0.patch @@ -0,0 +1,27 @@ +diff --git b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/itemencryptor/model/CollectionOfErrors.java a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/itemencryptor/model/CollectionOfErrors.java +index 1bb59f8f..19928c23 100644 +--- b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/itemencryptor/model/CollectionOfErrors.java ++++ a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/itemencryptor/model/CollectionOfErrors.java +@@ -4,6 +4,7 @@ + package software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.model; + + import java.util.List; ++import java.util.stream.Collectors; + + public class CollectionOfErrors extends RuntimeException { + +@@ -134,6 +135,14 @@ public class CollectionOfErrors extends RuntimeException { + } + + public CollectionOfErrors build() { ++ if (!(this.list == null || this.list.isEmpty())) { ++ this.message = ++ this.message + ++ " String representation of Exceptions in list.\n" + ++ this.list.stream() ++ .map(ex -> ex.getClass().getSimpleName() + ": " + ex.getMessage()) ++ .collect(Collectors.joining("\n")); ++ } + return new CollectionOfErrors(this); + } + } diff --git a/DynamoDbEncryption/codegen-patches/StructuredEncryption/java/dafny-4.8.0.patch b/DynamoDbEncryption/codegen-patches/StructuredEncryption/java/dafny-4.8.0.patch new file mode 100644 index 000000000..ab2ae6e07 --- /dev/null +++ b/DynamoDbEncryption/codegen-patches/StructuredEncryption/java/dafny-4.8.0.patch @@ -0,0 +1,27 @@ +diff --git b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/structuredencryption/model/CollectionOfErrors.java a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/structuredencryption/model/CollectionOfErrors.java +index a4d45a55..a6c2fc43 100644 +--- b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/structuredencryption/model/CollectionOfErrors.java ++++ a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/structuredencryption/model/CollectionOfErrors.java +@@ -4,6 +4,7 @@ + package software.amazon.cryptography.dbencryptionsdk.structuredencryption.model; + + import java.util.List; ++import java.util.stream.Collectors; + + public class CollectionOfErrors extends RuntimeException { + +@@ -134,6 +135,14 @@ public class CollectionOfErrors extends RuntimeException { + } + + public CollectionOfErrors build() { ++ if (!(this.list == null || this.list.isEmpty())) { ++ this.message = ++ this.message + ++ " String representation of Exceptions in list.\n" + ++ this.list.stream() ++ .map(ex -> ex.getClass().getSimpleName() + ": " + ex.getMessage()) ++ .collect(Collectors.joining("\n")); ++ } + return new CollectionOfErrors(this); + } + } diff --git a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/itemencryptor/model/CollectionOfErrors.java b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/itemencryptor/model/CollectionOfErrors.java index 1bb59f8f4..19928c232 100644 --- a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/itemencryptor/model/CollectionOfErrors.java +++ b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/itemencryptor/model/CollectionOfErrors.java @@ -4,6 +4,7 @@ package software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.model; import java.util.List; +import java.util.stream.Collectors; public class CollectionOfErrors extends RuntimeException { @@ -134,6 +135,14 @@ public List list() { } public CollectionOfErrors build() { + if (!(this.list == null || this.list.isEmpty())) { + this.message = + this.message + + " String representation of Exceptions in list.\n" + + this.list.stream() + .map(ex -> ex.getClass().getSimpleName() + ": " + ex.getMessage()) + .collect(Collectors.joining("\n")); + } return new CollectionOfErrors(this); } } diff --git a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CollectionOfErrors.java b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CollectionOfErrors.java index c6f441887..c2af7d327 100644 --- a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CollectionOfErrors.java +++ b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CollectionOfErrors.java @@ -4,6 +4,7 @@ package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; import java.util.List; +import java.util.stream.Collectors; public class CollectionOfErrors extends RuntimeException { @@ -134,6 +135,14 @@ public List list() { } public CollectionOfErrors build() { + if (!(this.list == null || this.list.isEmpty())) { + this.message = + this.message + + " String representation of Exceptions in list.\n" + + this.list.stream() + .map(ex -> ex.getClass().getSimpleName() + ": " + ex.getMessage()) + .collect(Collectors.joining("\n")); + } return new CollectionOfErrors(this); } } diff --git a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/transforms/model/CollectionOfErrors.java b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/transforms/model/CollectionOfErrors.java index 7a2ca9b05..db01d9610 100644 --- a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/transforms/model/CollectionOfErrors.java +++ b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/transforms/model/CollectionOfErrors.java @@ -4,6 +4,7 @@ package software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.model; import java.util.List; +import java.util.stream.Collectors; public class CollectionOfErrors extends RuntimeException { @@ -134,6 +135,14 @@ public List list() { } public CollectionOfErrors build() { + if (!(this.list == null || this.list.isEmpty())) { + this.message = + this.message + + " String representation of Exceptions in list.\n" + + this.list.stream() + .map(ex -> ex.getClass().getSimpleName() + ": " + ex.getMessage()) + .collect(Collectors.joining("\n")); + } return new CollectionOfErrors(this); } } diff --git a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/structuredencryption/model/CollectionOfErrors.java b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/structuredencryption/model/CollectionOfErrors.java index a4d45a553..a6c2fc436 100644 --- a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/structuredencryption/model/CollectionOfErrors.java +++ b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/structuredencryption/model/CollectionOfErrors.java @@ -4,6 +4,7 @@ package software.amazon.cryptography.dbencryptionsdk.structuredencryption.model; import java.util.List; +import java.util.stream.Collectors; public class CollectionOfErrors extends RuntimeException { @@ -134,6 +135,14 @@ public List list() { } public CollectionOfErrors build() { + if (!(this.list == null || this.list.isEmpty())) { + this.message = + this.message + + " String representation of Exceptions in list.\n" + + this.list.stream() + .map(ex -> ex.getClass().getSimpleName() + ": " + ex.getMessage()) + .collect(Collectors.joining("\n")); + } return new CollectionOfErrors(this); } }