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

Re: [PR] MINOR: Replace Collections factory methods with Java 11+ equivalents in clients [kafka]

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


##########
clients/src/main/java/org/apache/kafka/common/security/oauthbearer/internals/unsecured/OAuthBearerUnsecuredValidatorCallbackHandler.java:
##########
@@ -188,7 +188,7 @@ private String scopeClaimName() {
 
     private List<String> requiredScope() {
         String requiredSpaceDelimitedScope = option(REQUIRED_SCOPE_OPTION);
-        return Utils.isBlank(requiredSpaceDelimitedScope) ? Collections.emptyList() : OAuthBearerScopeUtils.parseScope(requiredSpaceDelimitedScope.trim());
+        return Utils.isBlank(requiredSpaceDelimitedScope) ? List.of() : OAuthBearerScopeUtils.parseScope(requiredSpaceDelimitedScope.trim());

Review Comment:
   I did find some time to check it, the JAAS option map values cannot be null in practice as in:
   https://github.com/apache/kafka/blob/9dfc5a724239042ed6add3e87c0041e3ef9c2dee/clients/src/main/java/org/apache/kafka/common/security/JaasConfig.java#L113-L119
   
   explicitly rejects null values during parsing. So Map.copyOf(), is safe here. I will update PR with changes. 
   



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