krashouk opened a new issue, #1888: URL: https://github.com/apache/rocketmq-dashboard/issues/1888
## 问题描述 `MonitorServiceImpl#loadData` 只有在主配置文件不存在时才读取备份。如果主文件存在但 JSON 已损坏,`JsonUtil.string2Obj` 返回 `null`,随后内部 `configMap` 被覆盖为 `null`;后续创建或更新监控配置会在 `put` 时抛出空指针异常。 ## 复现步骤 1. 在 dashboard 数据目录写入损坏的 `consumerMonitorConfig.json`。 2. 在对应 `.bak` 文件写入合法监控配置。 3. 初始化 `MonitorServiceImpl`。 4. 观察备份没有被采用;主备份都损坏时,后续更新操作还会触发 NPE。 ## 预期行为 按主文件、备份文件、空的可写 Map 顺序恢复,任何损坏输入都不应把运行时 Map 置为 `null`。 ## 环境 - 分支:`master` - 基线:`770822bbc812bfd0c2a94aa0128ab6f59b50d076` - JDK:17 ## 建议修复方向 将单文件读取和解析封装为可失败步骤,主文件解析失败后继续尝试备份,两者均不可用时保留空 `ConcurrentHashMap`。 -- 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]
