see-quick commented on code in PR #23242:
URL: https://github.com/apache/kafka/pull/23242#discussion_r3890266803


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/ThreadMetadataImpl.java:
##########
@@ -57,7 +57,7 @@ public ThreadMetadataImpl(final String threadName,
                               final Set<TaskMetadata> standbyTasks) {
         this.mainConsumerClientId = mainConsumerClientId;
         this.restoreConsumerClientId = restoreConsumerClientId;
-        this.producerClientIds = Collections.singleton(producerClientIds);
+        this.producerClientIds = producerClientIds != null ? 
Set.of(producerClientIds) : Set.of();

Review Comment:
   > Is it possible to pass null as producerClientIds?  
   
   In production code its always some value but when we do mock of the 
TaskManager in multiple our test cases in the `StreamThreadTest` fails on:
   ```java
   java.lang.NullPointerException
        at java.base/java.util.Objects.requireNonNull(Objects.java:209)
        at 
java.base/java.util.ImmutableCollections$Set12.<init>(ImmutableCollections.java:783)
        at java.base/java.util.Set.of(Set.java:470)
        at 
org.apache.kafka.streams.processor.internals.ThreadMetadataImpl.<init>(ThreadMetadataImpl.java:60)
        at 
org.apache.kafka.streams.processor.internals.StreamThread.updateThreadMetadata(StreamThread.java:2021)
        at 
org.apache.kafka.streams.processor.internals.StreamThreadTest.shouldThrottleEnforceRebalanceOnRepeatedShutdownRequestsUnderClassicProtocol(StreamThreadTest.java:4180)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
   ```
   because Mockito defualt unstubbed method returns String as null.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to