apache / apache/rocketmq

[Bug] cleanBrokerMetadata accepts malformed broker controller IDs

Open Beginner friendly
#10,861 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
22.6k
Forks
12k
Avg merge
3d 1h
Merged PRs (30d)
27

Description

## Runtime platform environment
macOS; reproduced through the `mqadmin cleanBrokerMetadata` command parser in the `tools` module.

## RocketMQ version
Branch: `develop`
Git commit: `fd0c95920e0deac96ce2ae27442747cc5e65e930`

## JDK Version
Eclipse Temurin 17.0.19+10

## Describe the Bug
`CleanControllerBrokerMetaSubCommand` attempts to validate the semicolon-separated broker controller IDs with `Arrays.stream(...).map(Long::parseLong)`. Because the stream has no terminal operation, parsing is never executed and malformed IDs pass validation.

## Steps to Reproduce
1. Parse `mqadmin cleanBrokerMetadata -a 127.0.0.1:9878 -bn broker-a -c cluster-a -b 1;not-a-number`.
2. Execute the command.
3. Observe that local validation does not reject `not-a-number` and execution proceeds toward the admin request.

## What Did You Expect to See?
The command should throw `IllegalArgumentException` for any non-numeric controller ID before starting a remote operation.

## What Did You See Instead?
The lazy stream is never consumed, so the malformed ID is accepted locally.

## Additional Context
A simple eager iteration preserves the existing input format and error message.

Contributor guide

Open the contributing guide

Research direction

Start at CleanControllerBrokerMetaSubCommand in the tools module and reproduce the malformed input with mqadmin cleanBrokerMetadata using a non-numeric broker controller ID. Check the existing validation path and confirm that the command rejects malformed IDs with IllegalArgumentException before making the admin request.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.