Skip to content

Commit d86363a

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 a8a1c27 commit d86363a

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,14 +364,14 @@ public static <K, V> ConsumerRecords<K, V> getRecords(Consumer<K, V> consumer, D
364364
do {
365365
long t1 = System.currentTimeMillis();
366366
ConsumerRecords<K, V> received = consumer.poll(Duration.ofMillis(remaining));
367+
if (received == null) {
368+
throw new IllegalStateException("null received from consumer.poll()");
369+
}
367370
logger.debug(() -> "Received: " + received.count() + ", "
368371
+ received.partitions().stream()
369372
.flatMap(p -> received.records(p).stream())
370373
// map to same format as send metadata toString()
371374
.map(r -> r.topic() + "-" + r.partition() + "@" + r.offset()).toList());
372-
if (received == null) {
373-
throw new IllegalStateException("null received from consumer.poll()");
374-
}
375375
if (minRecords < 0) {
376376
return received;
377377
}

0 commit comments

Comments
 (0)