You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/09/01 12:03:07 UTC
[GitHub] [dubbo-go-hessian2] zhwaaaaaa commented on issue #274: empty map write null but BC_MAP_UNTYPED+BC_END expected
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org