Closed xfstart07 closed 2 years ago
@xfstart07 还请你把原始的 java 和 go 代码贴进来
@xfstart07 can u try to simulate the issue problem following the example below:
@xfstart07 can u try to simulate the issue problem following the example below:
- https://github.com/apache/dubbo-go-hessian2/blob/f989170905c309700aba409389fefcd8f02849b3/test_hessian/src/test/java/unit/GoStringTest.java?_pjax=%23js-repo-pjax-container%2C%20div%5Bitemtype%3D%22http%3A%2F%2Fschema.org%2FSoftwareSourceCode%22%5D%20main%2C%20%5Bdata-pjax-container%5D#L32
- https://github.com/apache/dubbo-go-hessian2/blob/f989170905c309700aba409389fefcd8f02849b3/output/testfuncs/string.go?_pjax=%23js-repo-pjax-container%2C%20div%5Bitemtype%3D%22http%3A%2F%2Fschema.org%2FSoftwareSourceCode%22%5D%20main%2C%20%5Bdata-pjax-container%5D#L24
查出的问题记录:
2.如果 Go 的结构体定义中存在小写开头字段,会导致解析出错,原本应该读取的数据没有读取,这样数据就错乱了 https://github.com/apache/dubbo-go-hessian2/blob/master/object.go#L397
查出的问题记录:
- https://github.com/apache/dubbo-go-hessian2/blob/master/object.go#L472 断言 bool 值是返回的 err = nil, 导致无法报出实际的错误
2.如果 Go 的结构体定义中存在小写开头字段,会导致解析出错,原本应该读取的数据没有读取,这样数据就错乱了 https://github.com/apache/dubbo-go-hessian2/blob/master/object.go#L397
1: bool 在java 这边定义为boolean, 使用Boolean 现在还不支持. 2:go结构体字段不要定义为小写,定义为小写无法编解码.
1:boolean 和 java.lang.Boolean 是不一样的,你使用的是Boolean在java那边定义,在go这边hessian2 暂时还不支持编解码,你可以改为boolean 2:dubbo-go-hessian2 因为是按照字节顺序读取的,不支持skip. 建议使用的时候 序列化/反序列化的结构体是对应的。
1.但我看实际传过来的数据Boolean类型的值是 T, 源码 case tag == BC_TRUE: // 'T': //true
就有处理
@xfstart07 There is only classes definition,I don't find the unit test.
What happened:
DubboCodec.decodeRequest 方法中打印 requestBody
requestBody类似 "`NNNNNNNNNNNNNNNNNNNNNNNNNNNNTNN123456NNNNNasdfghH ", 有些字段是 N ,解析的时候不报错,但是有些传了的字段不会读取出来值
Java(DubboJava 版本 2.7) 数据类如下
https://github.com/xfstart07/dubbo-go-hessian2/blob/fix/javaclass/test_hessian/src/test/java/unit/GoStringTest.java
What you expected to happen:
期望解析出来传入有数据的字段
How to reproduce it (as minimally and precisely as possible):
Anything else we need to know?: