Skip to content

Commit e85c88c

Browse files
authored
GH-3810: Move the logging statement after the conditional statement in KafkaTestUtils (#3811)
Fixes: 3810 Issue link: #3810 Signed-off-by: kjy1994 <[email protected]> **Auto-cherry-pick to `3.3.x` & `3.2.x`**
1 parent d811c23 commit e85c88c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -368,14 +368,14 @@ public static <K, V> ConsumerRecords<K, V> getRecords(Consumer<K, V> consumer, D
368368
do {
369369
long t1 = System.currentTimeMillis();
370370
ConsumerRecords<K, V> received = consumer.poll(Duration.ofMillis(remaining));
371+
if (received == null) {
372+
throw new IllegalStateException("null received from consumer.poll()");
373+
}
371374
logger.debug(() -> "Received: " + received.count() + ", "
372375
+ received.partitions().stream()
373376
.flatMap(p -> received.records(p).stream())
374377
// map to same format as send metadata toString()
375378
.map(r -> r.topic() + "-" + r.partition() + "@" + r.offset()).toList());
376-
if (received == null) {
377-
throw new IllegalStateException("null received from consumer.poll()");
378-
}
379379
if (minRecords < 0) {
380380
return received;
381381
}

0 commit comments

Comments
 (0)