Skip to content

Conversation

@atheendre130505
Copy link
Contributor

Description
This PR implements character range support (e.g., [a-z], [0-9], [abc]) for glob pattern matching within the Kafka shell module. It addresses a long-standing TODO comment in GlobComponent.java.

The implementation includes:

  • Support for basic character ranges and sets.
  • Support for negation using both ! and ^ (e.g., [!a-z]).
  • Proper handling of escaped characters within brackets (e.g., [a\-z]).
  • Handling of literal ] as the first character in a set (e.g., []abc]).
  • Error handling for unterminated character classes.

Additionally, the toRegularExpression method was refactored to extract bracket and escape handling into separate private methods. This was done to reduce the NPath complexity from 1020 to within the project's Checkstyle limit (500).

Testing Strategy
The changes were verified using unit tests in GlobComponentTest.java.
A new set of comprehensive test cases was added to cover:

  • Basic character ranges and sets matching.
  • Negation patterns.
  • Escaped characters inside and outside brackets.
  • Combined patterns (e.g., character ranges with wildcards * and ?).
  • Edge cases like literal bracket placements and unterminated ranges.
  • Verified that existing shell glob tests still pass.

All tests were executed and passed on a local environment using OpenJDK 21.

License
I state that the contribution is my original work and that I license the work to the project under the project's open source license.

atheendre130505 and others added 7 commits October 26, 2025 22:19
- Add missing @return description in ProducerManager.publishMessage()
- Add missing @return description in RemoteLogMetadataCache.listAllRemoteLogSegments()
- Add missing @throws description in LogDirFailureChannel.takeNextOfflineLogDir()

All Javadoc tags now have proper descriptions following Apache Kafka documentation standards.
@github-actions github-actions bot added triage PRs from the community tools labels Jan 25, 2026
@atheendre130505
Copy link
Contributor Author

@halorgium , @astubbs , @amir , @alexism

@github-actions
Copy link

github-actions bot commented Feb 2, 2026

A label of 'needs-attention' was automatically added to this PR in order to raise the
attention of the committers. Once this issue has been triaged, the triage label
should be removed to prevent this automation from happening again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant