You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jens Geyer (JIRA)" <ji...@apache.org> on 2015/09/03 21:44:46 UTC
[jira] [Comment Edited] (THRIFT-3302) Go JSON protocol should
encode Thrift byte type as signed integer string
[ https://issues.apache.org/jira/browse/THRIFT-3302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14729656#comment-14729656 ]
Jens Geyer edited comment on THRIFT-3302 at 9/3/15 7:44 PM:
------------------------------------------------------------
Why don't we change the {{WriteByte(byte)}} methods into {{WriteByte(int8)}} while we're at it? All Thrift integers are [always signed by definition|https://thrift.apache.org/docs/types].
was (Author: jensg):
Why don't we change the {{WriteByte(byte)}} methods into {{WriteByte(int8)}} while we're at it? All Thrift integers are [always signed by definition](https://thrift.apache.org/docs/types).
> Go JSON protocol should encode Thrift byte type as signed integer string
> ------------------------------------------------------------------------
>
> Key: THRIFT-3302
> URL: https://issues.apache.org/jira/browse/THRIFT-3302
> Project: Thrift
> Issue Type: Bug
> Components: Go - Library
> Reporter: Nobuaki Sukegawa
> Assignee: Nobuaki Sukegawa
>
> h3. Problem
> Go implementation of JSON and simple JSON protocols encode Thrift byte type field as unsigned 8bit integer.
> i.e. -1 is encoded to "255" by Go implementation while "-1" by others like C++, Java and Python.
> h3. Reproduce
> Cross test with go server and py client (JSON protocols of course).
> (like "expected -127 but got 129")
> Static-typed clients (such as C++ and Java) are not likely to notice the difference because of integer overflow.
> h3. Fix
> Explicitly convert the unsigned 8-bit value back to signed one in JSON protocols before converting to text.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)