[ISSUE #10780] Reject empty cluster batch ack handles - #10781
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request hardens the Proxy batch-ack path by validating input handle lists up front, preventing runtime exceptions and returning a stable, meaningful failed future (per Issue #10780).
Changes:
- Add a null/empty guard in
ClusterMessageService.batchAckMessage()to avoidIndexOutOfBoundsExceptionwhen resolving broker address from the first handle. - Return a failed future with
ProxyExceptionCode.INVALID_RECEIPT_HANDLEfor invalid (null/empty) handle lists. - Add regression tests for null/empty handle list behavior and assert the MQ client is not invoked.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| proxy/src/main/java/org/apache/rocketmq/proxy/service/message/ClusterMessageService.java | Adds early validation for null/empty handle lists and returns a failed future instead of throwing. |
| proxy/src/test/java/org/apache/rocketmq/proxy/service/message/ClusterMessageServiceTest.java | Adds regression coverage for null/empty handle lists and verifies the MQ client is not called. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (handleList == null || handleList.isEmpty()) { | ||
| return FutureUtils.completeExceptionally(new ProxyException( | ||
| ProxyExceptionCode.INVALID_RECEIPT_HANDLE, | ||
| "receipt handle list is empty" | ||
| )); | ||
| } |
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review by github-manager-bot
Summary
Adds null/empty guard for in before accessing , returning a failed future with instead of throwing .
Findings
- [Info] The fix is correct and minimal. Returning a failed (rather than throwing) is consistent with the async contract of this method.
- [Info] Test coverage is good — both null and empty cases are verified, and confirms no downstream call is made on early rejection.
Suggestions
- Consider whether the same guard should be applied to (single-handle variant) for consistency, if it does not already have one.
LGTM.
Automated review by github-manager-bot
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review by github-manager-bot
Summary
Adds null/empty guard for in before accessing , returning a failed future with instead of throwing .
Findings
- [Info] The fix is correct and minimal. Returning a failed (rather than throwing) is consistent with the async contract of this method.
- [Info] Test coverage is good — both null and empty cases are verified, and the verification confirms no downstream call is made on early rejection.
Suggestions
- Consider whether the same guard should be applied to (single-handle variant) for consistency, if it does not already have one.
LGTM.
Automated review by github-manager-bot
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review by github-manager-bot
Summary
Adds null/empty guard for handleList in ClusterMessageService.batchAckMessage() before accessing handleList.get(0), returning a failed future with INVALID_RECEIPT_HANDLE instead of throwing IndexOutOfBoundsException.
Findings
- [Info] The fix is correct and minimal. Returning a failed
CompletableFuture(rather than throwing) is consistent with the async contract of this method. - [Info] Test coverage is good — both null and empty cases are verified, and the
never()verification confirms no downstream call is made on early rejection.
Suggestions
- Consider whether the same guard should be applied to
ackMessage()(single-handle variant) for consistency, if it does not already have one.
LGTM.
Automated review by github-manager-bot
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #10781 +/- ##
=============================================
- Coverage 48.24% 48.23% -0.01%
+ Complexity 13496 13490 -6
=============================================
Files 1380 1380
Lines 101104 101106 +2
Branches 13107 13107
=============================================
- Hits 48773 48767 -6
- Misses 46350 46357 +7
- Partials 5981 5982 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What changed
ClusterMessageService.batchAckMessage()before resolving broker address from the first handle.INVALID_RECEIPT_HANDLEinstead of throwingIndexOutOfBoundsException.Fixes #10780.
Verification
mvn -pl proxy -Dtest=ClusterMessageServiceTest testResult: BUILD SUCCESS.
ClusterMessageServiceTestran 3 tests with 0 failures, errors, or skips. Checkstyle and SpotBugs also passed in the Maven run.