Skip to content

Commit 5e3a5f7

Browse files
Remove unused local variable. Check for empty messages list as special case.
1 parent 9d5a235 commit 5e3a5f7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/com/amazon/sqs/javamessaging/AmazonSQSExtendedAsyncClient.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,13 @@ public CompletableFuture<ReceiveMessageResponse> receiveMessage(ReceiveMessageRe
196196

197197
return super.receiveMessage(receiveMessageRequest)
198198
.thenCompose(receiveMessageResponse -> {
199-
ReceiveMessageResponse.Builder receiveMessageResponseBuilder = receiveMessageResponse.toBuilder();
200-
201199
List<Message> messages = receiveMessageResponse.messages();
200+
201+
// Check for no messages. If so, no need to process further.
202+
if (messages.isEmpty()) {
203+
return CompletableFuture.completedFuture(messages);
204+
}
205+
202206
List<CompletableFuture<Message>> modifiedMessageFutures = new ArrayList<>(messages.size());
203207
for (Message message : messages) {
204208
Message.Builder messageBuilder = message.toBuilder();

0 commit comments

Comments
 (0)