Deepika-lab opened a new pull request, #23573:
URL: https://github.com/apache/kafka/pull/23573

   Jira: https://issues.apache.org/jira/browse/KAFKA-21041
   
   `ClientMetricsConfigs.parseMatchingPatterns` split client match patterns 
with `String.split("=")`, which splits on *every* `=` and rejects patterns like 
`client_id=foo=bar` with `InvalidConfigurationException`. The method's own 
Javadoc specifies that the pattern is split into two parts at the *first* 
occurrence of `=`, so this changes it to `split("=", 2)`, keeping any 
additional `=` characters as part of the regular expression.
   
   Also adds `ClientMetricsConfigsTest` with focused unit tests for 
`parseMatchingPatterns` (valid patterns, empty input, invalid patterns throwing 
`InvalidConfigurationException`), including a regression test for regexes 
containing `=`.
   
   Tests run (Gradle daemon cannot start in this sandbox, so compiled and ran 
directly with javac/java against kafka-clients 4.3.1 + JUnit 5):
   - New `ClientMetricsConfigsTest`: 4 tests, all pass
   - Verified the new regression test fails against the pre-fix code and passes 
with the fix
   
   Note: I could not run `spotlessCheck`/`checkstyle` locally for the same 
environment reason; the change follows the surrounding style and import order. 
Happy to address any CI findings.


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