btlqql opened a new pull request, #10733:
URL: https://github.com/apache/rocketmq/pull/10733
### Motivation
Four edge-case crashes found by code review (verified against the current
develop branch):
1. **`AdminBrokerProcessor.queryCorrectionOffset` NPE**
(`broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java`)
`correctionOffset` only contains queueIds present in the topic's offset
table. When the compare group has an offset for a queue no other group
consumed, `correctionOffset.get(queueId)` is `null` and the ternary
auto-unboxes it → NPE, failing the `QUERY_CORRECTION_OFFSET` admin RPC. Guarded
with a null check.
2. **`ConsumeQueue.estimateMessageCount` NPE**
(`store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java`)
`consumeQueueExt.get(tagCode)` returns `null` for CQ entries written
before ext was enabled (or when a previous ext put fell back to a plain
tagsCode), so `ext.getTagsCode()` threw NPE and broke consumer-lag metrics.
Skip when `ext` is `null` (the filter already handles a `null` CqExtUnit).
3. **`TransactionalMessageServiceImpl` IndexOutOfBoundsException**
(`broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java`)
`opMsg` can be a non-null **empty** list, so `opMsg.get(opMsg.size() -
1)` threw `IndexOutOfBoundsException` and aborted the entire transaction-check
pass for all queues. Guarded with `!opMsg.isEmpty()`.
4. **`HttpTinyClient` NPE on error responses without a body**
(`common/src/main/java/org/apache/rocketmq/common/utils/HttpTinyClient.java`)
`HttpURLConnection.getErrorStream()` returns `null` when the error
response has no body; `IOTinyUtils.toString(null, ...)` threw NPE and broke
namesrv discovery via `DefaultTopAddressing`. Guarded both `httpGet` and
`httpPost`.
### Verification
`mvn -pl broker -am compile` passes on the build server.
### Diff
4 files changed, +15 / -6.
--
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]