Skip to content

Commit

Permalink
fix(Java): Improve Collection of Errors string (#1478)
Browse files Browse the repository at this point in the history
  • Loading branch information
texastony authored Nov 26, 2024
1 parent cc937b4 commit 562b3ef
Show file tree
Hide file tree
Showing 9 changed files with 147 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ test/**/Output/*
specification_compliance_report.html
/compliance
/.smithy.lsp.log

# logs
*.log
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -134,6 +135,14 @@ public List<RuntimeException> 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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -134,6 +135,14 @@ public List<RuntimeException> 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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -134,6 +135,14 @@ public List<RuntimeException> 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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -134,6 +135,14 @@ public List<RuntimeException> 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);
}
}
Expand Down

0 comments on commit 562b3ef

Please sign in to comment.