Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-3302

Go JSON protocol should encode Thrift byte type as signed integer string

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.9.3
    • Go - Library
    • None
    • Patch Available

    Description

      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.

      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.

      Fix

      Explicitly convert the unsigned 8-bit value back to signed one in JSON protocols before converting to text.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            nsuke Nobuaki Sukegawa
            nsuke Nobuaki Sukegawa
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment