[ISSUE #10853] fix(store): validate HA state ordinals - #10858
Conversation
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
The change correctly replaces unchecked HAConnectionState.values()[ordinal] lookups with a bounds-safe fromOrdinal helper, preventing ArrayIndexOutOfBoundsException on malformed HA state ordinals. However, the newly added test file contains a malformed annotation that will block compilation, so that must be fixed before merge. Additionally, the contributor CLA is unsigned, which must be resolved prior to approval.
Automated review by github-manager-bot
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #10858 +/- ##
=============================================
+ Coverage 48.39% 48.44% +0.05%
+ Complexity 13562 13552 -10
=============================================
Files 1380 1380
Lines 101165 101171 +6
Branches 13127 13129 +2
=============================================
+ Hits 48962 49017 +55
+ Misses 46233 46148 -85
- Partials 5970 6006 +36 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
The malformed test annotation from the previous review has been fixed. The fromOrdinal helper is correctly bounds-checked, server-side properly rejects unknown slave state ordinals, and client-side safely handles unknown master states via null return. Tests cover boundary cases adequately. LGTM.
Automated review by github-manager-bot
Which Issue(s) This PR Fixes
Brief Description
Adds bounds-checked HA state decoding. The server rejects unknown slave state ordinals and the client logs mismatched unknown master states without indexing outside the enum array. Adds boundary tests for state decoding.
How Did You Test This Change?
mise x java@temurin-17 -- mvn -Dmaven.repo.local=/private/tmp/rocketmq-m2 -pl store -am -DskipITs -Dtest=HAConnectionStateTest -Dsurefire.failIfNoSpecifiedTests=false testThe targeted tests, Checkstyle, and SpotBugs completed successfully.