Skip to content
Snippets Groups Projects
Commit 4316a99b authored by Jan Zickermann's avatar Jan Zickermann
Browse files

OZG-4094 Fix NPE for empty messages

parent ad21ba79
No related branches found
No related tags found
2 merge requests!9Draft: Ozg 4094 wiremock ausprobieren,!7Ozg-4094 Konfiguration für nachrichten-manager
Pipeline #1590 passed
package de.ozgcloud.nachrichten.postfach.osiv2.transfer;
import java.util.Collection;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Stream;
......@@ -34,7 +36,10 @@ public class PostfachApiFacadeService {
public Stream<PostfachNachricht> receiveMessages() {
var response = messageExchangeApi.receiveMessages(MAX_NUMBER_RECEIVED_MESSAGES, 0);
return response.getMessages().stream().map(this::fetchMessageByGuid);
return Optional.ofNullable(response.getMessages())
.stream()
.flatMap(Collection::stream)
.map(this::fetchMessageByGuid);
}
PostfachNachricht fetchMessageByGuid(final MessageExchangeReceiveMessage message) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment