refactor(hessian2): use generic exception from hessian2#3378
Conversation
|
you should contribute to https://github.com/apache/dubbo-go-hessian2 , |
|
please update all of your prs, your base branch should be develop and your target branch should be develop |
efb95eb to
2f19e80
Compare
|
Updated this PR to target develop and rebased the branch on upstream/develop. The local validation still passes: go test ./protocol/dubbo/hessian2 ./protocol/dubbo/impl and git diff --check. The previous failed CI job failed during Codecov CLI signature verification (gpg: Can't check signature: No public key), after Go tests had completed, so there was no code/test failure in that run. Regarding the hessian2 direction: this PR removes the local dubbo-go GenericException definition and uses dubbo-go-hessian2's java_exception.DubboGenericException directly. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3378 +/- ##
===========================================
+ Coverage 46.76% 52.90% +6.13%
===========================================
Files 295 493 +198
Lines 17172 37953 +20781
===========================================
+ Hits 8031 20080 +12049
- Misses 8287 16250 +7963
- Partials 854 1623 +769 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
2f19e80 to
1b979bd
Compare
|
Added focused tests for the Codecov patch coverage feedback. The new coverage exercises ToGenericException conversions, GenericException DetailMessage formatting, and the pointer DubboGenericException encode paths in both hessian2 packResponse and impl marshalResponse. Local validation: go test ./protocol/dubbo/hessian2 ./protocol/dubbo/impl, go test -cover ./protocol/dubbo/hessian2 ./protocol/dubbo/impl, git diff --check, and the local audit script all pass. |
1b979bd to
0fe7af9
Compare
|
Follow-up for the remaining Codecov patch coverage warning: added packResponse coverage for the value DubboGenericException and Throwabler branches. Local validation still passes: go test ./protocol/dubbo/hessian2 ./protocol/dubbo/impl, go test -cover ./protocol/dubbo/hessian2 ./protocol/dubbo/impl, git diff --check, and the local audit script. |
|
Follow-up on the hessian2-side direction from the review: I opened apache/dubbo-go-hessian2#396 to complete the library-side change. It makes |
There was a problem hiding this comment.
Pull request overview
This PR addresses #3361 by refactoring Dubbo Hessian2 generic exception handling to use the dubbo-go-hessian2-provided java_exception.DubboGenericException type instead of a locally-defined GenericException, aligning exception encoding/decoding with the shared Hessian2 library.
Changes:
- Remove the local
GenericExceptiontype usage and migrate encoding paths to directly encodejava_exception.DubboGenericException. - Update
ToGenericExceptionto return*java_exception.DubboGenericExceptionand add helper logic for legacy/throwable conversions. - Update and extend tests to assert the Hessian2 generic exception type is used end-to-end.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
protocol/dubbo/impl/hessian.go |
Encodes DubboGenericException directly in response marshalling. |
protocol/dubbo/impl/hessian_test.go |
Updates response marshal/unmarshal tests to assert Hessian2 exception types (including pointer/value cases). |
protocol/dubbo/hessian2/hessian_response.go |
Refactors ToGenericException to return Hessian2 DubboGenericException and adjusts response exception encoding. |
protocol/dubbo/hessian2/hessian_response_test.go |
Adds focused tests for ToGenericException conversions and generic-exception response packing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
@Snow-kal @xxs588 @CAICAIIs help review this and apache/dubbo-go-hessian2#396 |
以上仅供参考 |
|
Thanks, I agree with the direction. I checked the current dependency versions: The constructor-side fix is still in apache/dubbo-go-hessian2#396 and is not available from an upstream module version yet. Once that hessian2 PR is merged and available to dubbo-go, I can update the dependency here and replace |



Description
Fixes #3361.
This PR migrates Dubbo generic exception handling to the type provided by
dubbo-go-hessian2:GenericExceptionstruct fromprotocol/dubbo/hessian2ToGenericExceptionreturn*java_exception.DubboGenericExceptionValidation
go test ./protocol/dubbo/hessian2 -run 'TestToGenericExceptionUsesHessianExceptionType|TestIsSupportResponseAttachment|TestVersion2Int'go test ./protocol/dubbo/impl -run 'TestHessianSerializer|TestMarshalResponse|TestUnmarshalResponseBody'go test ./protocol/dubbo/hessian2 ./protocol/dubbo/implgit diff --checkChecklist
main