You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2013/09/10 21:35:54 UTC
[3/3] git commit: THRIFT-2176 TSimpleJSONProtocol.ReadFieldBegin()
does not return field type and ID
THRIFT-2176 TSimpleJSONProtocol.ReadFieldBegin() does not return field type and ID
Patch: Jens Geyer
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/4ba1160c
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/4ba1160c
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/4ba1160c
Branch: refs/heads/master
Commit: 4ba1160c41805ac6bc3548baadf0a700af8925ae
Parents: 901d555
Author: Jens Geyer <je...@apache.org>
Authored: Tue Sep 10 21:33:55 2013 +0200
Committer: Jens Geyer <je...@apache.org>
Committed: Tue Sep 10 21:34:45 2013 +0200
----------------------------------------------------------------------
lib/go/thrift/serializer_test.go | 2 +-
lib/go/thrift/simple_json_protocol.go | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/4ba1160c/lib/go/thrift/serializer_test.go
----------------------------------------------------------------------
diff --git a/lib/go/thrift/serializer_test.go b/lib/go/thrift/serializer_test.go
index 5912679..0f3f7d7 100644
--- a/lib/go/thrift/serializer_test.go
+++ b/lib/go/thrift/serializer_test.go
@@ -146,7 +146,7 @@ func TestSerializer(t *testing.T) {
protocol_factories = make(map[string]ProtocolFactory)
protocol_factories["Binary"] = NewTBinaryProtocolFactoryDefault()
protocol_factories["Compact"] = NewTCompactProtocolFactory()
- protocol_factories["SimpleJSON"] = NewTSimpleJSONProtocolFactory()
+ //protocol_factories["SimpleJSON"] = NewTSimpleJSONProtocolFactory() - write only, can't be read back by design
protocol_factories["JSON"] = NewTJSONProtocolFactory()
var tests map[string]func(*testing.T, ProtocolFactory) (bool, error)
http://git-wip-us.apache.org/repos/asf/thrift/blob/4ba1160c/lib/go/thrift/simple_json_protocol.go
----------------------------------------------------------------------
diff --git a/lib/go/thrift/simple_json_protocol.go b/lib/go/thrift/simple_json_protocol.go
index 3755a2d..71598ac 100644
--- a/lib/go/thrift/simple_json_protocol.go
+++ b/lib/go/thrift/simple_json_protocol.go
@@ -330,6 +330,9 @@ func (p *TSimpleJSONProtocol) ReadFieldBegin() (string, TType, int16, error) {
case JSON_QUOTE:
p.reader.ReadByte()
name, err := p.ParseStringBody()
+ // simplejson is not meant to be read back into thrift
+ // - see http://wiki.apache.org/thrift/ThriftUsageJava
+ // - use JSON instead
if err != nil {
return name, STOP, 0, err
}