sofastack / sofa-rpc

SOFARPC is a high-performance, high-extensibility, production-level Java RPC framework.
https://www.sofastack.tech/sofa-rpc/docs/Home
Apache License 2.0
3.82k stars 1.17k forks source link

Fix#1254#1305 bug on JSON serialization and deserialization #1306

Closed gofow closed 1 year ago

gofow commented 1 year ago

Motivation:

Fix#1254#1305 bug on JSON serialization and deserialization

Modification:

  1. In BeanSerializer.serialize(), create a fresh Map when the "bean" is a Map instance, in order to prevent any unpredictable changes due to references
  2. In BeanSerializer.serialize(), use class.getName() rather than class.getCanonicalName() when the bean is a custom object, in order to get correct representation of inner class for class loader
  3. Add two cases to JSONTest
sofastack-bot[bot] commented 1 year ago

Hi @gofow, welcome to SOFAStack community, Please sign Contributor License Agreement!

After you signed CLA, we will automatically sync the status of this pull request in 3 minutes.

EvenLjj commented 1 year ago

image @gofow Pls format code by mvn clean compile before git push.

gofow commented 1 year ago

@EvenLjj Thank you! Actually I'm feeling confused about the error, and I have done with the format.

codecov[bot] commented 1 year ago

Codecov Report

Merging #1306 (19fdf5a) into master (75bc1ff) will decrease coverage by 0.02%. The diff coverage is 100.00%.

@@             Coverage Diff              @@
##             master    #1306      +/-   ##
============================================
- Coverage     71.97%   71.96%   -0.02%     
  Complexity      783      783              
============================================
  Files           415      415              
  Lines         17651    17651              
  Branches       2753     2753              
============================================
- Hits          12705    12703       -2     
- Misses         3538     3546       +8     
+ Partials       1408     1402       -6     
Impacted Files Coverage Δ
...om/alipay/sofa/rpc/common/json/BeanSerializer.java 87.07% <100.00%> (+0.56%) :arrow_up:
...java/com/alipay/sofa/rpc/module/LookoutModule.java 52.38% <0.00%> (-33.34%) :arrow_down:
...n/java/com/alipay/sofa/rpc/common/SofaConfigs.java 84.90% <0.00%> (-1.89%) :arrow_down:
...ay/sofa/rpc/client/AllConnectConnectionHolder.java 60.76% <0.00%> (-0.26%) :arrow_down:
...lipay/sofa/rpc/message/AbstractResponseFuture.java 57.01% <0.00%> (+0.87%) :arrow_up:
.../com/alipay/sofa/rpc/context/RpcInvokeContext.java 82.40% <0.00%> (+0.92%) :arrow_up:
...com/alipay/sofa/rpc/context/RpcRuntimeContext.java 90.12% <0.00%> (+1.23%) :arrow_up:
...pay/sofa/rpc/transport/ClientTransportFactory.java 78.46% <0.00%> (+1.53%) :arrow_up:
...n/java/com/alipay/sofa/rpc/log/TimeWaitLogger.java 84.00% <0.00%> (+4.00%) :arrow_up:
... and 1 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.