This is an automated email from the ASF dual-hosted git repository.

mjsax pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new f69337b37cf MINOR: use `isEmpty()` to avoid compiler warning (#19616)
f69337b37cf is described below

commit f69337b37cf60d4f76cf01a51f454023083af775
Author: Matthias J. Sax <[email protected]>
AuthorDate: Thu May 1 23:51:36 2025 -0700

    MINOR: use `isEmpty()` to avoid compiler warning (#19616)
    
    Reviewers: Anna Sophie Blee-Goldman <[email protected]>
---
 .../producer/internals/ProducerInterceptorsTest.java       | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git 
a/clients/src/test/java/org/apache/kafka/clients/producer/internals/ProducerInterceptorsTest.java
 
b/clients/src/test/java/org/apache/kafka/clients/producer/internals/ProducerInterceptorsTest.java
index 74f5db74062..c81de1d74fc 100644
--- 
a/clients/src/test/java/org/apache/kafka/clients/producer/internals/ProducerInterceptorsTest.java
+++ 
b/clients/src/test/java/org/apache/kafka/clients/producer/internals/ProducerInterceptorsTest.java
@@ -69,9 +69,10 @@ public class ProducerInterceptorsTest {
             onAckCount++;
             if (exception != null) {
                 onErrorAckCount++;
-                // the length check is just to call topic() method and let it 
throw an exception
-                // if RecordMetadata.TopicPartition is null
-                if (metadata != null && metadata.topic().length() >= 0) {
+                if (metadata != null) {
+                    if (metadata.topic() == null) {
+                        throw new NullPointerException("Topic is null");
+                    }
                     onErrorAckWithTopicSetCount++;
                     if (metadata.partition() >= 0)
                         onErrorAckWithTopicPartitionSetCount++;
@@ -124,9 +125,10 @@ public class ProducerInterceptorsTest {
             onAckCount++;
             if (exception != null) {
                 onErrorAckCount++;
-                // the length check is just to call topic() method and let it 
throw an exception
-                // if RecordMetadata.TopicPartition is null
-                if (metadata != null && metadata.topic().length() >= 0) {
+                if (metadata != null) {
+                    if (metadata.topic() == null) {
+                        throw new NullPointerException("Topic is null");
+                    }
                     onErrorAckWithTopicSetCount++;
                     if (metadata.partition() >= 0)
                         onErrorAckWithTopicPartitionSetCount++;

Reply via email to