-
Notifications
You must be signed in to change notification settings - Fork 29
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
hessian.js序列化异常,同一个类,可选参数不同,会读缓存的上一个类 #130
Comments
提供一下测试用例? |
提的时候没注意看,和另外一个 #120 一样 {
"$class": "java.util.List",
"$": [
{
"$class": "a",
"$": {
"id": {
"$class": "java.lang.Long",
"$": "33341"
},
"status": {
"$class": "java.lang.Integer",
"$": 2
}
}
},
{
"$class": "a",
"$": {
"id": {
"$class": "java.lang.Long",
"$": "33342"
},
"status": {
"$class": "java.lang.Integer",
"$": 3
},
"reason": {
"$class": "java.lang.Integer",
"$": 33
}
}
}
]
} |
@tyouzu1 你是动态类型参数?如果是跟 java 的约定一致,java 加载 jar 包之后的 class 元信息是固定并且有序的,不太可能动态变化的。这是一个约定前提。 |
好吧 ,后端说就这样的类型 ,现在暂时只能靠添加完整字段解决.. |
@tyouzu1 可以考虑一下 https://github.com/sofastack/sofa-hessian-node,提前把类型生成到 classmap 里就没有这个问题了。如果是 $class 这种写法,必须每次都把字端写全才可以。 |
好的,我研究看看 |
有一个类 A = { x, y },内部参数是可选的,比如{x} {y}
这次请求 参数为 { a: {x} , b: { c: { y } }},也就是两次使用A类,一次为{x} 一次为{y}
序列化的时候会出现问题
this._classRefFields 会存一个{x}的类的key ,导致{y}参数序列化的时候,读了上一次的缓存,找不到y 的key
this.write(realObj[key]); 的时候就没法写入 y 参数
The text was updated successfully, but these errors were encountered: