tang7526 opened a new pull request #10012:
URL: https://github.com/apache/kafka/pull/10012


   - Invoke method only conditionally.
   - No need to call "toString()" method as formatting and string conversion is 
done by the Formatter.  
   
   before
   ```java
   log.info("Successfully validated token with principal {}: {}", 
unsecuredJwt.principalName(), unsecuredJwt.claims().toString());
   ```
   
   after
   ```java
   if (log.isInfoEnabled()) {
       log.info("Successfully validated token with principal {}: {}", 
unsecuredJwt.principalName(), unsecuredJwt.claims());
   }
   ```
   
   - Immediately return the expression instead of assigning it to the temporary 
variable.
   
   before
   ```java
   String principalClaimName = principalClaimNameValue != null && 
!principalClaimNameValue.trim().isEmpty()
           ? principalClaimNameValue.trim()
           : "sub";
   return principalClaimName;
   ```
   
   after
   ```java
   return principalClaimNameValue != null && 
!principalClaimNameValue.trim().isEmpty()
           ? principalClaimNameValue.trim()
           : "sub";
   ```
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


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