From b19c846099f6b097ad0f47ac983c0047549d7db2 Mon Sep 17 00:00:00 2001 From: Anton Pinsky Date: Tue, 14 Nov 2023 09:46:12 +0100 Subject: [PATCH] [#1965] Filter out the null elements from the list of errors in GraphQLClientException --- .../smallrye/graphql/client/GraphQLClientException.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/api/src/main/java/io/smallrye/graphql/client/GraphQLClientException.java b/client/api/src/main/java/io/smallrye/graphql/client/GraphQLClientException.java index 3e280a0b8..27a90b062 100644 --- a/client/api/src/main/java/io/smallrye/graphql/client/GraphQLClientException.java +++ b/client/api/src/main/java/io/smallrye/graphql/client/GraphQLClientException.java @@ -1,10 +1,12 @@ package io.smallrye.graphql.client; +import static java.util.Collections.singletonList; import static java.util.Objects.requireNonNull; import static java.util.stream.Collectors.joining; -import java.util.Collections; import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; /** * Represents a response that contained application-level errors and thus can't be turned into a domain object. @@ -17,12 +19,12 @@ public class GraphQLClientException extends RuntimeException { public GraphQLClientException(String message, GraphQLError error) { super(message); - this.errors = Collections.singletonList(requireNonNull(error)); + this.errors = singletonList(requireNonNull(error)); } public GraphQLClientException(String message, List errors) { super(message); - this.errors = requireNonNull(errors); + this.errors = requireNonNull(errors).stream().filter(Objects::nonNull).collect(Collectors.toList()); } @Override