GH-3810: Move the logging statement after the conditional statement in KafkaTestUtils (#3811)

Fixes: 3810

Issue link: https://github.com/spring-projects/spring-kafka/issues/3810

Signed-off-by: kjy1994 <ghgh415263@naver.com>

(cherry picked from commit e85c88c56a)
This commit is contained in:
Kim JaeYeon
2025-03-20 01:01:10 +09:00
committed by Spring Builds
parent a8a1c27e9d
commit d86363af4e

View File

@@ -364,14 +364,14 @@ public final class KafkaTestUtils {
do {
long t1 = System.currentTimeMillis();
ConsumerRecords<K, V> received = consumer.poll(Duration.ofMillis(remaining));
if (received == null) {
throw new IllegalStateException("null received from consumer.poll()");
}
logger.debug(() -> "Received: " + received.count() + ", "
+ received.partitions().stream()
.flatMap(p -> received.records(p).stream())
// map to same format as send metadata toString()
.map(r -> r.topic() + "-" + r.partition() + "@" + r.offset()).toList());
if (received == null) {
throw new IllegalStateException("null received from consumer.poll()");
}
if (minRecords < 0) {
return received;
}