[Bug] Proxy DefaultAdminService can NPE on malformed current broker data
- Dominant language
- Java
- Stars
- 22.6k
- Forks
- 12k
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 27
Description
### Problem
`DefaultAdminService#createTopicOnBroker` null-checks broker addresses in `sampleBrokerDataList`, but not in `curBrokerDataList`:
```java
for (BrokerData brokerData : curBrokerDataList) {
curBrokerAddr.add(brokerData.getBrokerAddrs().get(MixAll.MASTER_ID));
}
```
If the current route data contains a malformed `BrokerData` with `brokerAddrs == null`, this throws a `NullPointerException` before the method can create the topic on valid sample brokers.
### Expected behavior
Malformed current broker rows should be ignored when building the set of existing broker addresses. This should match the later sample broker handling, which already skips null broker address maps and missing master addresses.
### Impact
A stale or partial route response can prevent Proxy admin topic creation from proceeding, even when valid sample broker data is available.
### Suggested fix
- Null-check `brokerData` and `brokerData.getBrokerAddrs()` while collecting current broker addresses.
- Skip null master broker addresses.
- Add regression coverage for a current broker row with null broker addresses.
Contributor guide
Research direction
Start at DefaultAdminService#createTopicOnBroker and compare current broker address collection with the later sample broker handling. Add regression coverage for a current BrokerData row with null broker addresses, and verify malformed rows are skipped so topic creation can proceed using valid sample brokers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100