in src/java/detectors/aws_batch_write_output_ignored/AwsBatchWriteOutputIgnored.java [33:55]
public void flushCompliant(final SqsClient amazonSqs,
final String sqsEndPoint,
final List<SendMessageBatchRequestEntry> batch)
throws SQSUpdateException, CloneNotSupportedException {
if (batch.isEmpty() || sqsEndPoint == null) {
return;
}
SendMessageBatchResult sendResult =
amazonSqs.sendMessageBatch(sqsEndPoint, batch);
if (sendResult == null) {
return;
} else {
final List<BatchResultErrorEntry> failed = sendResult.getFailed();
// Compliant: has checks to handle errors returned by batch operations.
if (!failed.isEmpty()) {
final String failedMessage = failed.stream()
.map(batchResultErrorEntry -> String.format("messageId:%s failedReason:%s",
batchResultErrorEntry.getId(), batchResultErrorEntry.getMessage()))
.collect(Collectors.joining(","));
throw new SQSUpdateException("Error occurred while sending messages to SQS::" + failedMessage);
}
}
}