Repository: thrift
Updated Branches:
  refs/heads/master eb5f11745 -> ef2b5285f


THRIFT-3145 JSON protocol does not handle bool and empty containers correctly
Client: Haskell
Patch: Rhys Adams

Fix deserialization of empty list and set.


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/f48e339c
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/f48e339c
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/f48e339c

Branch: refs/heads/master
Commit: f48e339cc99aab7f6206c360d4193dd9944ad156
Parents: eb5f117
Author: Rhys Adams <[email protected]>
Authored: Tue May 12 09:51:00 2015 +0900
Committer: Nobuaki Sukegawa <[email protected]>
Committed: Sun Dec 13 14:07:17 2015 +0900

----------------------------------------------------------------------
 lib/hs/src/Thrift/Protocol/JSON.hs | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/f48e339c/lib/hs/src/Thrift/Protocol/JSON.hs
----------------------------------------------------------------------
diff --git a/lib/hs/src/Thrift/Protocol/JSON.hs 
b/lib/hs/src/Thrift/Protocol/JSON.hs
index f378ea2..ba19ad7 100644
--- a/lib/hs/src/Thrift/Protocol/JSON.hs
+++ b/lib/hs/src/Thrift/Protocol/JSON.hs
@@ -149,14 +149,16 @@ parseJSONValue (T_MAP kt vt) = fmap (TMap kt vt) $
     between '{' '}' (parseJSONMap kt vt)
 parseJSONValue (T_LIST ty) = fmap (TList ty) $
   between '[' ']' $ do
-    len <- lexeme escapedString *> lexeme (PC.char8 ',') *>
-           lexeme decimal <* lexeme (PC.char8 ',')
-    if len > 0 then parseJSONList ty else return []
+    len <- lexeme escapedString *> lexeme (PC.char8 ',') *> lexeme decimal
+    if len > 0
+      then lexeme (PC.char8 ',') *> parseJSONList ty
+      else return []
 parseJSONValue (T_SET ty) = fmap (TSet ty) $
   between '[' ']' $ do
-    len <- lexeme escapedString *> lexeme (PC.char8 ',') *>
-           lexeme decimal <* lexeme (PC.char8 ',')
-    if len > 0 then parseJSONList ty else return []
+    len <- lexeme escapedString *> lexeme (PC.char8 ',') *> lexeme decimal
+    if len > 0
+      then  lexeme (PC.char8 ',') *> parseJSONList ty
+      else return []
 parseJSONValue T_BOOL =
   (TBool True <$ string "true") <|> (TBool False <$ string "false")
 parseJSONValue T_BYTE = TByte <$> signed decimal

Reply via email to