Skip to content

Commit

Permalink
fixed unhandled IOException
Browse files Browse the repository at this point in the history
  • Loading branch information
saschaszott authored Oct 24, 2023
1 parent b43c340 commit 9b3f7b6
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,22 @@ private String generateBodyMail(Context context, List<IndexableObject> indexable
if (indexableObjects == null) {
return EMPTY;
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
out.write("\n".getBytes(UTF_8));
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
out.write("\n".getBytes(UTF_8));
for (IndexableObject indexableObject : indexableObjects) {
out.write("\n".getBytes(UTF_8));
Item item = (Item) indexableObject.getIndexedObject();
String entityType = itemService.getEntityTypeLabel(item);
Optional.ofNullable(entityType2Disseminator.get(entityType))
.orElseGet(() -> entityType2Disseminator.get("Item"))
.disseminate(context, item, out);
}
}
return out.toString();
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return out.toString();
return EMPTY;
}

public void setEntityType2Disseminator(Map<String, StreamDisseminationCrosswalk> entityType2Disseminator) {
Expand Down

0 comments on commit 9b3f7b6

Please sign in to comment.