showuon commented on a change in pull request #11195:
URL: https://github.com/apache/kafka/pull/11195#discussion_r685829914



##########
File path: streams/src/main/java/org/apache/kafka/streams/kstream/Branched.java
##########
@@ -143,6 +143,7 @@ protected Branched(final Branched<K, V> branched) {
      */
     @Override
     public Branched<K, V> withName(final String name) {
+        Objects.requireNonNull(name, "name cannot be null");
         return new Branched<>(name, chainFunction, chainConsumer);

Review comment:
       We have a similar method: `as` that accept a `name` parameter to create 
a Branched instance 
[here](https://github.com/apache/kafka/blob/trunk/streams/src/main/java/org/apache/kafka/streams/kstream/Branched.java#L53).
 We did a `name` null check there. We should also have a null check here for 
consistency.
   ```java
   public static <K, V> Branched<K, V> as(final String name) {
           Objects.requireNonNull(name, "name cannot be null");
           return new Branched<>(name, null, 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