Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Decoder failed to decode int8/int16 type values of map field in struct #366

Merged
merged 2 commits into from Nov 1, 2023

Conversation

ahaostudy
Copy link
Contributor

@ahaostudy ahaostudy commented Oct 31, 2023

What this PR does:

Fix Decoder failed to decode int8/int16 type values of map field in struct

Which issue(s) this PR fixes:

Currently, dubbo-go-hessian2 is unable to correctly decode values of type int8 / int16 that are contained within a map type field in a struct, resulting in a panic during the decoding process.

This PR is intended to fix this issue, which will enhance the compatibility between dubbo-go and dubbo-java.

Special notes for your reviewer:

I am a developer of the Kitex framework, and currently, DubboCodec is utilizing dubbo-go-hessian2 as its encoder/decoder. We also hope to resolve this issue through this PR, enabling us to support decoding of int8 and int16 types.

img_v2_f5ff3858-80ba-4b3f-8e15-3794d2109ccg

Does this PR introduce a user-facing change?:

NONE

@ahaostudy ahaostudy changed the title fix issue where Decoder panics when decoding an Object containing a Map with int8/int16 as key or value type fix Decoder failed to decode int8/int16 type values of map field in struct Oct 31, 2023
map_test.go Outdated
if err != nil {
t.Errorf("Decode() = %+v", err)
}
t.Logf("decode(%v) = %v, %v\n", obj, res, err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should check whether the decode value is equal to the original

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@codecov-commenter
Copy link

Codecov Report

Merging #366 (c4fcd98) into master (f0fbe40) will increase coverage by 0.24%.
The diff coverage is 100.00%.

❗ Current head c4fcd98 differs from pull request most recent head fbdccbe. Consider uploading reports for the commit fbdccbe to get more accurate results

@@            Coverage Diff             @@
##           master     #366      +/-   ##
==========================================
+ Coverage   68.98%   69.23%   +0.24%     
==========================================
  Files          28       28              
  Lines        3140     3146       +6     
==========================================
+ Hits         2166     2178      +12     
+ Misses        751      745       -6     
  Partials      223      223              
Files Coverage Δ
map.go 63.81% <100.00%> (+4.23%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@tiltwind tiltwind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jasondeng1997 jasondeng1997 merged commit fb070d0 into apache:master Nov 1, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants