zhwaaaaaa commented on issue #274:
URL:
https://github.com/apache/dubbo-go-hessian2/issues/274#issuecomment-910217158
v1.9.2
map.go line 120.
null is not expected. instead of empty map (BC_MAP_UNTYPED+BC_END)
`
keys = value.MapKeys()
if len(keys) == 0 {
// fix: set nil for empty map
e.buffer = EncNull(e.buffer)
return nil
}
typ = value.Type().Key()
e.buffer = encByte(e.buffer, BC_MAP_UNTYPED)
for i := 0; i < len(keys); i++ {
k, err = getMapKey(keys[i], typ)
if err != nil {
return perrors.Wrapf(err, "getMapKey(idx:%d, key:%+v)",
i, keys[i])
}
if err = e.Encode(k); err != nil {
return perrors.Wrapf(err, "failed to encode map
key(idx:%d, key:%+v)", i, keys[i])
}
entryValueObj := value.MapIndex(keys[i]).Interface()
if err = e.Encode(entryValueObj); err != nil {
return perrors.Wrapf(err, "failed to encode map
value(idx:%d, key:%+v, value:%+v)", i, k, entryValueObj)
}
}
e.buffer = encByte(e.buffer, BC_END)`
--
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]