-
Notifications
You must be signed in to change notification settings - Fork 26.3k
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
dubbo3处理boolean属性(默认值为true)时,服务端设置为false,但客户端拿到的是ture #12833
Comments
试了一下确实有问题 |
JSON序列化的问题 |
我已经在fastjson2仓库提了bug |
那是JSONWriter.Feature.NotWriteDefaultValue的问题了? bugfix前建议怎么处理,preferSerialization改用hessian2吗? |
只能等待修复 |
尝试了下,用包装类好像可以解决~ |
在Java中,boolean的默认值为false,fastjson的 |
包装类或者不设置默认值都能解决,但这个本身算一个巨大的问题。序列化前后不一样,要么dubbo去改要么fastjson那边去改 |
这个参数是 fastjson2 侧为了减低序列化包大小使用的,具体怎么修复还需要 @wenshao 看一下 |
感觉fastjson2现在还不太稳定呀 |
怎么能说是不太稳定呢,那是相当的不稳定。 |
序列化的配置去掉这个: JSONWriter.Feature.NotWriteDefaultValue |
这个是序列化时配置了JSONWriter.Feature.NotWriteDefaultValue,序列化时boolean的false值就不输出了,而反序列化时没有值,用到了类中的缺省值。 |
那现在这种对不上的不算问题? @AlbumenJ 是不是Dubbo这边要去掉这个配置? |
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.39-SNAPSHOT/ |
经过测试,上述问题已经解决。 |
https://github.com/alibaba/fastjson2/releases/tag/2.0.39 |
Environment
Steps to reproduce this issue
Pls. provide [GitHub address] to reproduce this issue.
sample code:
https://github.com/liyesa/dubbo-bug
Expected Behavior
boolean值能正确返回
Actual Behavior
有初始值=true的boolean属性,client拿到的永远是false;
补充:
在doubbo admin执行,返回结果正常
在telnet执行,返回结果正常
设置preferSerialization为 hessian2,返回结果正确
If there is an exception, please attach the exception trace:
NONE error log
The text was updated successfully, but these errors were encountered: