Skip to content

Commit 5c22ccf

Browse files
ghgh415263spring-builds
authored andcommitted
GH-3810: Move the logging statement after the conditional statement in KafkaTestUtils (#3811)
Fixes: 3810 Issue link: #3810 Signed-off-by: kjy1994 <[email protected]> (cherry picked from commit e85c88c)
1 parent d2fdea8 commit 5c22ccf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

spring-kafka-test/src/main/java/org/springframework/kafka/test/utils/KafkaTestUtils.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -337,14 +337,14 @@ public static <K, V> ConsumerRecords<K, V> getRecords(Consumer<K, V> consumer, D
337337
do {
338338
long t1 = System.currentTimeMillis();
339339
ConsumerRecords<K, V> received = consumer.poll(Duration.ofMillis(remaining));
340+
if (received == null) {
341+
throw new IllegalStateException("null received from consumer.poll()");
342+
}
340343
logger.debug(() -> "Received: " + received.count() + ", "
341344
+ received.partitions().stream()
342345
.flatMap(p -> received.records(p).stream())
343346
// map to same format as send metadata toString()
344347
.map(r -> r.topic() + "-" + r.partition() + "@" + r.offset()).toList());
345-
if (received == null) {
346-
throw new IllegalStateException("null received from consumer.poll()");
347-
}
348348
if (minRecords < 0) {
349349
return received;
350350
}

0 commit comments

Comments
 (0)