Repository navigation
Conversation
Replace String.split(regex) and Pattern.split(input) calls with their two-argument form passing -1 as the limit, which makes the splitting behavior explicit by preserving trailing empty strings. This addresses all 22 ErrorProne StringSplitter warnings across 10 files without requiring Guava's Splitter or suppression annotations. Fixes: kroxylicious#5025 Assisted-by: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Francisco Vila <fvila@redhat.com>
Assisted-by: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Francisco Vila <fvila@redhat.com>
franvila
force-pushed
the
fix/05049-stringsplitter-errorprone
branch
from
October 8, 2026 11:34
ac4e6e5 to
4283256
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change
Description
Replace all
String.split(regex)andPattern.split(input)calls with their two-argument form passing-1as the limit. This makes the splitting behavior explicit by preserving trailing empty strings, which is what ErrorProne's StringSplitter check requires.This resolves all 22 StringSplitter warnings across 10 files without introducing Guava's
Splitteror adding@SuppressWarningsannotations.Affected modules:
kroxylicious-runtime(HostPort)kroxylicious-openmessaging-benchmarks(RunMetadata, ResultComparatorTest)kroxylicious-integration-tests(ExpositionIT, ProxyProtocolIT, RoutingContextContractIT, SaslTerminationOauthBearerIT, AbstractAuthzEquivalenceIT, AuthzIT)kroxylicious-systemtests(Environment, Exec, DeploymentUtils, KafkaVersionUtils)Additional Context
The
String.split(String)method silently discards trailing empty strings, which can lead to surprising behavior. Passing-1as the limit makes the behavior explicit and predictable. See https://errorprone.info/bugpattern/StringSplitter.Checklist
@SuppressWarningsand a justifying comment).Assisted-by:trailer (see DEV_GUIDE.md).changelog/unreleased/(remember to include changes affecting the API of the test artefacts too). See DEV_GUIDE.md for the entry format.🤖 Generated with Claude Code