Skip to content

Commit

Permalink
handle stringbuilder to avoid exception (#1544)
Browse files Browse the repository at this point in the history
  • Loading branch information
MohabMohie authored Mar 22, 2024
1 parent 912e446 commit a401f81
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -623,9 +623,12 @@ public static void log(String logText, List<List<Object>> attachments) {
if (attachments != null && !attachments.isEmpty() && (attachments.size() > 1 || (attachments.getFirst() != null && !attachments.getFirst().isEmpty()))) {
attachments.forEach(attachment -> {
if (attachment != null && !attachment.isEmpty()) {
if (attachment.get(2) instanceof String) {
if (attachment.get(2) instanceof String string) {
attachAsStep(attachment.get(0).toString(), attachment.get(1).toString(),
new ByteArrayInputStream(attachment.get(2).toString().getBytes()));
new ByteArrayInputStream(string.getBytes()));
} else if (attachment.get(2) instanceof StringBuilder stringBuilder) {
attachAsStep(attachment.get(0).toString(), attachment.get(1).toString(),
new ByteArrayInputStream(stringBuilder.toString().getBytes()));
} else {
attachAsStep(attachment.get(0).toString(), attachment.get(1).toString(),
(InputStream) attachment.get(2));
Expand Down

0 comments on commit a401f81

Please sign in to comment.