Skip to content

[ISSUE-10861] Fix brokerControllerIdsToClean validation not actually parsing IDs - #10869

Open
YALI58 wants to merge 1 commit into
apache:developfrom
YALI58:fix/issue-10861-broker-controller-id-validation
Open

[ISSUE-10861] Fix brokerControllerIdsToClean validation not actually parsing IDs#10869
YALI58 wants to merge 1 commit into
apache:developfrom
YALI58:fix/issue-10861-broker-controller-id-validation

Conversation

@YALI58

@YALI58 YALI58 commented Aug 8, 2026

Copy link
Copy Markdown

Bug Description

cleanBrokerMetadata command uses Arrays.stream(...).map(Long::parseLong) to validate broker controller IDs. Since map() is a lazy intermediate operation without a terminal operation, Long.parseLong() is never executed, allowing malformed IDs like not-a-number to pass validation.

Fix

Changed map() to forEach() so the stream is actually consumed and Long.parseLong() is evaluated for each ID.

Testing

Added CleanControllerBrokerMetaSubCommandTest with a test case that verifies malformed input throws IllegalArgumentException.

Closes #10861

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Automated deep analysis encountered an error. General recommendations: ensure adequate test coverage, verify thread safety for concurrent paths, check backward compatibility of API changes.

Findings

No specific findings.


Automated review by github-manager-bot

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Good catch — map() is a lazy intermediate operation so Long.parseLong() was never actually executed, allowing malformed IDs to pass validation silently. Changing to forEach() correctly forces evaluation.

The test case properly verifies that malformed input now throws IllegalArgumentException.


Automated review by "github-manager-bot"

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] cleanBrokerMetadata accepts malformed broker controller IDs

2 participants