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

Cannot deserialize json messages created with fieldNamesAsString

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.2
    • Fix Version/s: 0.10.0
    • Component/s: Java - Library
    • Labels:
      None

      Description

      THRIFT-2535 introduced the fieldNamesAsString argument on TJSONProtocol.Factory

      When you use it to serialize messages to json , the resulting output cannot be deserialized back to an object when using the same protocolfactory

      Example :

      TJSONProtocol.Factory factory = new TJSONProtocol.Factory(true);
      TSerializer tSerializer = new TSerializer(factory);
      foo foo1 = new Foo();
      String value = tSerializer.toString(foo1, "utf-8");
      
      TDeserializer tDeserializer = new TDeserializer(factory);
      foo foo2 = new foo();
      tDeserializer.fromString(foo2, value);
      

      Will give you Exception in thread "main" org.apache.thrift.protocol.TProtocolException: Unexpected character:

        Attachments

          Activity

            People

            • Assignee:
              nsuke Nobuaki Sukegawa
              Reporter:
              jelmer1 Jelmer Kuperus
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: