edoclin opened a new issue, #15750:
URL: https://github.com/apache/dubbo/issues/15750

   ### Pre-check
   
   - [x] I am sure that all the content I provide is in English.
   
   
   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Apache Dubbo Component
   
   Java SDK (apache/dubbo)
   
   ### Dubbo Version
   
   Apache dubbo: 3.3.4,  java 8, hessian-lite 4.0.3
   
   
   ### Steps to reproduce this issue
   
   
hessian-lite/src/main/java/com/alibaba/com/caucho/hessian/io/UnsafeDeserializer.java#instantiate
   
hessian-lite/src/main/java/com/alibaba/com/caucho/hessian/io/JavaDeserializer.java#instantiate
   
   
   Migrating from dubbo2 to dubbo3, some entity classes still initialize 
default values, for example:
   
   ```java
   public class Example { private String all = "all"; }
   ```
   
   UnsafeDeserializer constructs objects via allocateInstance; in certain 
scenarios, the deserialized object ends up with` obj.all = null` rather than 
the default `obj.all = "all"`.
   
   Using the startup parameter `-Dcom.caucho.hessian.unsafe=false` switches the 
deserializer to 
`hessian-lite/src/main/java/com/alibaba/com/caucho/hessian/io/JavaDeserializer.java`,
 which effectively solves the field default value issue.
   
   However, when JavaDeserializer deserializes BigInteger with a null 
constructor argument, it throws an NPE (compared to dubbo2.7: 
`com.alibaba.com.caucho.hessian.io.BigIntegerDeserializer` provides a dedicated 
compatibility class).
   
   Is there a method to make UnsafeDeserializer honor field default 
initializations, or a way to make JavaDeserializer compatible with BigInteger 
deserialization?
   
   ### What you expected to happen
   
   Provide a plan for ensuring deserialization compatibility during the 
migration process.
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit a pull request to fix on your own?
   
   - [ ] Yes I am willing to submit a pull request on my own!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to