yyqdbngt opened a new pull request, #711:
URL: https://github.com/apache/rocketmq-dashboard/pull/711
### Motivation
Four defensive fixes for runtime crashes found by code review:
1. **TopicServiceImpl.sendTopicMessageRequest** — when a topic has no broker
route, `topicConfigInfos.get(0)` threw `IndexOutOfBoundsException`. Now a clear
`ServiceException` is thrown instead.
2. **DashboardCollectTask.collectBroker** —
`kvTable.getTable().get("getTotalTps")` could be `null` or blank, causing a
`NullPointerException` or a divide-by-zero when the blank value splits into an
empty array. The broker is now skipped when there is no TPS data.
3. **DashboardCollectServiceImpl.jsonDataFile2map** — an empty or corrupt
dashboard data file makes `JSONObject.parse` return `null`, so
`json.entrySet()` threw `NullPointerException`. An empty map is returned
instead.
4. **FileUserStrategy.FileBasedUserInfoStore.load** — a non-numeric role in
`users.properties` threw `NumberFormatException` outside of any `try/catch`,
aborting application startup. It is now treated as a normal user (role 0) with
a warning logged.
### Verification
`mvn compiler:compile` passes (`BUILD SUCCESS`).
### Diff
4 files changed, +21 / -3.
--
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]