tju-yxq opened a new pull request, #2423:
URL: https://github.com/apache/rocketmq-dashboard/pull/2423
## Why
`MetadataService.deleteTopic` normalized the instance identifier but passed
the topic name straight through:
```java
public void deleteTopic(String instanceId, String name) {
instanceId = normalizeInstanceId(instanceId);
resolve(instanceId).deleteTopic(instanceId, name);
}
```
Most sibling operations in the same service use `requireName(...)`, which
rejects blank input and trims valid names. This method did not. A direct
service call with a blank name could reach provider resolution, and a
whitespace-padded name reached the Apache broker/NameServer deletion path and
cloud `DeleteTopicRequest` without normalization.
Closes #2422.
## Change
`deleteTopic` now applies the same service-boundary rule as topic routes,
topic consumers, and consumer-group operations:
- blank/null topic names return the existing 400 `topic name is required`;
- valid names are trimmed once;
- the normalized name is passed to the selected provider.
Provider routing, Apache deletion semantics, local metadata cleanup, audits,
and instance identifier normalization are unchanged.
## Verification
Focused tests:
```text
mvn "-Dtest=MetadataServiceTest#deleteTopic*" test
3 tests
0 failures
0 errors
BUILD SUCCESS
Checkstyle: 0 violations
```
Full backend suite:
```text
mvn -DskipTests=false test
1,483 tests
0 failures
0 errors
BUILD SUCCESS
```
`git diff --check` passes.
New regression coverage:
- a whitespace-padded name delegates as `"topic-to-delete"`;
- a blank service-level name fails before provider resolution;
- the existing controller tests continue to cover missing and blank HTTP
request bodies.
--
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]