[ISSUE #10890] Validate gRPC client language metadata - #10891
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #10891 +/- ##
=============================================
- Coverage 48.60% 48.54% -0.07%
+ Complexity 13690 13668 -22
=============================================
Files 1381 1381
Lines 101464 101470 +6
Branches 13187 13188 +1
=============================================
- Hits 49318 49259 -59
- Misses 46158 46199 +41
- Partials 5988 6012 +24 ☔ 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
This PR centralizes gRPC client language parsing in ClientActivity.parseLanguage(), replacing 3 direct LanguageCode.valueOf() calls that would throw unhandled exceptions on malformed input. Previously, these would surface as gRPC INTERNAL errors (server-side fault); now they correctly map to BAD_REQUEST / INVALID_ARGUMENT (client-side fault).
Verdict: LGTM — clean, focused defensive programming fix with good test coverage.
Findings
- [Info]
proxy/.../ClientActivity.java:462-470— TheparseLanguagemethod usesStringUtils.isBlank()for the empty check, which is good. Consider also trimming the input beforevalueOf()to handle whitespace-only values (e.g.," ") consistently —isBlankcatches this, but the error message"unsupported language: "could be slightly confusing. Minor, not blocking.
Automated review by "github-manager-bot"
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Centralizes gRPC language metadata parsing and rejects invalid values. Prevents INTERNAL errors from malformed input.
LGTM.
Automated review by github-manager-bot
Signed-off-by: liuhy <liuhongyu@apache.org>
Signed-off-by: liuhy <liuhongyu@apache.org>
6f6debf to
2d79a49
Compare
|
Rebased onto current |
What is the purpose of the change
Malformed or missing gRPC language metadata reached
LanguageCode.valueOfand was reported as a server-sideINTERNALerror.Closes #10890
Brief changelog
ClientActivity;Code.BAD_REQUEST;INVALID_ARGUMENT.Verifying this change