[ISSUE #10685] Tolerate malformed timer properties in gRPC converter - #10686
[ISSUE #10685] Tolerate malformed timer properties in gRPC converter#10686Aias00 wants to merge 2 commits into
Conversation
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review by github-manager-bot
Summary
Adds safe parsing for optional timer properties (PROPERTY_TIMER_DELAY_SEC and PROPERTY_TIMER_DELIVER_MS) in GrpcConverter.buildSystemProperties to tolerate malformed values instead of throwing NumberFormatException.
Findings
- [Info]
GrpcConverter.java:254— The newparseLongMessagePropertyhelper is well-designed: returnsnullfor missing properties, catchesNumberFormatExceptionfor malformed values, and logs with sufficient context (topic, msgId, property name, value) for debugging. - [Info]
GrpcConverter.java:191-200— The refactoreddelivery_timestampblock is cleaner. The precedence (delay-sec first, then deliver-ms) is preserved from the original code. - [Info]
GrpcConverterTest.java— Good test coverage: 5 new test cases covering valid delay, invalid delay, valid deliver, invalid deliver, and both missing. Tests useTimestamps.toMillisfor assertion which is correct.
Suggestions
- [Info] Consider making
parseLongMessagePropertyprivateinstead ofprotectedif external subclassing is not intended. The test class is in the same package, soprivatewith package-private test access or@VisibleForTestingwould also work. This is a minor style point and not blocking.
Overall: Clean defensive improvement. The change prevents a potential runtime exception from propagating to gRPC clients when broker messages contain malformed timer metadata.
Automated review by github-manager-bot
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #10686 +/- ##
=============================================
- Coverage 48.31% 48.24% -0.07%
+ Complexity 13511 13486 -25
=============================================
Files 1380 1380
Lines 101091 101099 +8
Branches 13101 13102 +1
=============================================
- Hits 48844 48780 -64
- Misses 46285 46337 +52
- Partials 5962 5982 +20 ☔ 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.
Review by github-manager-bot (Re-review)
PR #10686: [ISSUE #10685] Tolerate malformed timer properties in gRPC converter
Re-review scope: New commit c5f8888 — "Narrow timer property parser visibility"
Changes Since Last Review
parseLongMessagePropertyvisibility narrowed (private helper) — correct encapsulation since it is only used withinGrpcConverter- Simplified the delivery timestamp logic: removed intermediate variables, made the flow more linear
Assessment
Correctness — The refactoring preserves the original behavior while improving readability.
Design — Making the helper private is the right call — it is an internal implementation detail.
Overall: LGTM — Clean refactoring, no concerns.
Automated re-review by github-manager-bot
Which Issue(s) This PR Fixes
Fixes #10685
Brief Description
GrpcConverter.buildSystemPropertiespreviously parsedPROPERTY_TIMER_DELAY_SECandPROPERTY_TIMER_DELIVER_MSwithLong.parseLongdirectly. If either optional timer property was malformed, converting a BrokerMessageExtto the gRPC v2Messageresponse could throwNumberFormatException.This PR adds safe parsing for those timer properties. Valid values still populate
delivery_timestamp; malformed values are ignored with a warning so the message conversion can continue.How Did You Test This Change?
mvn -pl proxy -Dtest=GrpcConverterTest -DfailIfNoTests=false testResult:
BUILD SUCCESS,Tests run: 6, Failures: 0, Errors: 0, Skipped: 0.