You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Gimini-3 (via GitHub)" <gi...@apache.org> on 2026/08/05 08:34:03 UTC

[PR] KAFKA-20894: Make StreamsGroupDescription.toString null-safe [kafka]

Gimini-3 opened a new pull request, #23083:
URL: https://github.com/apache/kafka/pull/23083

   [KAFKA-20894](https://issues.apache.org/jira/browse/KAFKA-20894)
   
   `DescribeStreamsGroupsOptions` omits authorized operations by default. The omitted response value is converted to `null`, which is a documented valid state for `StreamsGroupDescription.authorizedOperations()`. However, `StreamsGroupDescription.toString()` unconditionally called `stream()` on that nullable set, so logging or otherwise rendering a successfully described group could throw `NullPointerException`.
   
   This change renders omitted authorized operations as `null` while preserving the existing output format for populated sets. It also extends the existing AdminClient test for an omitted authorized-operations response to verify that the resulting description can be converted to a string and includes `authorizedOperations=null`.
   
   Testing:
   - `DOCKER_API_VERSION=1.40 ./gradlew clients:test`
   - `./gradlew clients:test --tests org.apache.kafka.clients.admin.KafkaAdminClientTest.testDescribeStreamsGroupsWithAuthorizedOperationsOmitted --tests org.apache.kafka.clients.admin.internals.DescribeStreamsGroupsHandlerTest`
   - `./gradlew spotlessCheck`
   - `./gradlew clients:spotbugsMain clients:spotbugsTest -x test`
   
   The full clients test suite, targeted regression tests, Checkstyle, SpotBugs main analysis, and Spotless checks passed. `clients:spotbugsTest` was skipped by the build configuration.


-- 
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: jira-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-20894: Make StreamsGroupDescription.toString null-safe [kafka]

Posted by "mjsax (via GitHub)" <gi...@apache.org>.
mjsax commented on PR #23083:
URL: https://github.com/apache/kafka/pull/23083#issuecomment-5271933307

   Thanks for the fix. Merged to `trunk` and cherry-picked to `4.4` branch.


-- 
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: jira-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-20894: Make StreamsGroupDescription.toString null-safe [kafka]

Posted by "mjsax (via GitHub)" <gi...@apache.org>.
mjsax merged PR #23083:
URL: https://github.com/apache/kafka/pull/23083


-- 
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: jira-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-20894: Make StreamsGroupDescription.toString null-safe [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #23083:
URL: https://github.com/apache/kafka/pull/23083#discussion_r3773991385


##########
clients/src/main/java/org/apache/kafka/clients/admin/StreamsGroupDescription.java:
##########
@@ -247,7 +247,9 @@ public String toString() {
             ", members=" + members.stream().map(StreamsGroupMemberDescription::toString).collect(Collectors.joining(",")) +
             ", groupState=" + groupState +
             ", coordinator=" + coordinator +
-            ", authorizedOperations=" + authorizedOperations.stream().map(AclOperation::toString).collect(Collectors.joining(",")) +
+            ", authorizedOperations=" + (authorizedOperations == null ?

Review Comment:
   It seems that other description classes simply use `", authorizedOperations=" + authorizedOperations`, which can resolve this NPE as well, and the output is readable.
   
   The current approach is fine. I'm just reviewing code and a bit nitpicky today :)



-- 
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: jira-unsubscribe@kafka.apache.org

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