yyqdbngt opened a new pull request, #2968:
URL: https://github.com/apache/rocketmq-dashboard/pull/2968
## Summary
- `ClusterService.probeRegistryEntry` renames every cluster returned by
`ClusterProvider.discoverClustersAt` before aggregating it. A single
`null` element in that
list made the rename loop NPE, and the catch-all degraded the **entire**
registry entry to
empty — discarding every valid cluster the probe had found.
- The method now treats a `null` discovery result as empty and skips `null`
elements, keeping
all valid clusters from the response.
## Why
`ClusterProvider` is an interface; `RealClusterProvider` happens to never
emit nulls, but any
other implementation (or a future edit) can return a list with a null hole.
Today that one null
element silently wipes out the whole entry from the `/api/clusters/registry`
listing instead of
costing a single cluster.
## Testing
- `mvn -Dtest=ClusterServiceRegistryTest,ClusterServiceTest test`: Tests
run: 46,
Failures: 0, Errors: 0, Skipped: 0 (7 + 39).
- New
`listRegistryClustersShouldKeepValidClustersWhenDiscoveryReturnsNullElementTest`
verified to fail on the unfixed code (Tests run: 7, Failures: 1) — the
valid cluster is lost
because the NPE degrades the whole entry.
- New `listRegistryClustersShouldTreatNullDiscoveryResultAsEmptyTest` pins
the null-list
behaviour (already safe via the catch-all, now explicit).
--
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]