chia7712 commented on pull request #9374:
URL: https://github.com/apache/kafka/pull/9374#issuecomment-704046977


   Nice finding!
   
   Is there also a potential NPE in server-side? According to the protocol 
schema 
(https://github.com/apache/kafka/blob/trunk/clients/src/main/resources/common/message/DescribeUserScramCredentialsRequest.json#L23),
 the field ```users``` is nullable. Does server have to handle null as 
well?(https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/server/KafkaApis.scala#L3068).
   
   For another, if server is able to handle null, it should be fine to set null 
to ```users```. Hence, we can simplify client code as following style.
   
   ```java
               @Override
               public DescribeUserScramCredentialsRequest.Builder 
createRequest(int timeoutMs) {
                   return new DescribeUserScramCredentialsRequest.Builder(
                           new 
DescribeUserScramCredentialsRequestData().setUsers(users == null ? null : 
users.stream().map(user ->
                                   new 
DescribeUserScramCredentialsRequestData.UserName().setName(user)).collect(Collectors.toList())));
               }
   ```
   
   please let me know what you think :)


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to