RockteMQ-AI commented on issue #10861:
URL: https://github.com/apache/rocketmq/issues/10861#issuecomment-5225832971
**Issue Evaluation**
Category: `bug` | Status: **Confirmed**
The reported issue has been verified against the current codebase (commit
`fd0c959`).
**Root Cause:** In `CleanControllerBrokerMetaSubCommand.execute()` (line
89), the stream pipeline:
```java
Arrays.stream(brokerControllerIdsToClean.split(";"))
.map(idStr -> Long.parseLong(idStr));
```
The `map()` is a lazy intermediate operation — it is never consumed by a
terminal operation (e.g., `collect()`, `forEach()`), so `Long.parseLong()` is
never actually invoked. The `try/catch` for `NumberFormatException` is dead
code. Malformed IDs (e.g., `"abc"`, empty strings from `"1;;2"`) pass through
silently.
**Impact:** Users can specify invalid broker controller IDs without any
error, leading to silent failures or unexpected behavior in metadata cleanup
operations.
**Severity:** medium — admin tool silently accepts invalid input
**Suggested Fix:** Add a terminal operation to force evaluation and validate
each parsed ID:
```java
List<Long> ids = Arrays.stream(brokerControllerIdsToClean.split(";"))
.map(String::trim)
.filter(s -> !s.isEmpty())
.map(idStr -> {
try {
return Long.parseLong(idStr);
} catch (NumberFormatException e) {
throw new SubCommandException("Invalid brokerControllerId: " +
idStr);
}
})
.collect(Collectors.toList());
```
An automated fix proposal will be generated. Reply `/approve` to proceed
with PR generation.
---
*Automated evaluation by RockteMQ-AI*
--
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]