From 797595049274b9085385de5ef402075f6fc3de56 Mon Sep 17 00:00:00 2001 From: Jens Geyer Date: Thu, 26 Dec 2013 18:56:54 +0100 Subject: [PATCH] THRIFT-2285 TJsonProtocol implementation for Java/JavaMe/PHP doesn't allow a slash (/) to be escaped (\/) Patch: Jens Geyer --- lib/java/src/org/apache/thrift/protocol/TJSONProtocol.java | 4 ++-- lib/javame/src/org/apache/thrift/protocol/TJSONProtocol.java | 4 ++-- lib/php/lib/Thrift/Protocol/TJSONProtocol.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/java/src/org/apache/thrift/protocol/TJSONProtocol.java b/lib/java/src/org/apache/thrift/protocol/TJSONProtocol.java index f07a4a74..02f36e3c 100644 --- a/lib/java/src/org/apache/thrift/protocol/TJSONProtocol.java +++ b/lib/java/src/org/apache/thrift/protocol/TJSONProtocol.java @@ -70,10 +70,10 @@ public class TJSONProtocol extends TProtocol { 1, 1,'"', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 2 }; - private static final String ESCAPE_CHARS = "\"\\bfnrt"; + private static final String ESCAPE_CHARS = "\"\\/bfnrt"; private static final byte[] ESCAPE_CHAR_VALS = { - '"', '\\', '\b', '\f', '\n', '\r', '\t', + '"', '\\', '/', '\b', '\f', '\n', '\r', '\t', }; private static final int DEF_STRING_SIZE = 16; diff --git a/lib/javame/src/org/apache/thrift/protocol/TJSONProtocol.java b/lib/javame/src/org/apache/thrift/protocol/TJSONProtocol.java index fd92d453..de7086f7 100644 --- a/lib/javame/src/org/apache/thrift/protocol/TJSONProtocol.java +++ b/lib/javame/src/org/apache/thrift/protocol/TJSONProtocol.java @@ -66,10 +66,10 @@ public class TJSONProtocol extends TProtocol { 1, 1, '"', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 2 }; - private static final String ESCAPE_CHARS = "\"\\bfnrt"; + private static final String ESCAPE_CHARS = "\"\\/bfnrt"; private static final byte[] ESCAPE_CHAR_VALS = { - '"', '\\', '\b', '\f', '\n', '\r', '\t', + '"', '\\', '/', '\b', '\f', '\n', '\r', '\t', }; private static final int DEF_STRING_SIZE = 16; diff --git a/lib/php/lib/Thrift/Protocol/TJSONProtocol.php b/lib/php/lib/Thrift/Protocol/TJSONProtocol.php index 3d395833..402401ac 100644 --- a/lib/php/lib/Thrift/Protocol/TJSONProtocol.php +++ b/lib/php/lib/Thrift/Protocol/TJSONProtocol.php @@ -57,10 +57,10 @@ class TJSONProtocol extends TProtocol 1, 1, '"', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 2 ); - public static $ESCAPE_CHARS = array('"', '\\', "b", "f", "n", "r", "t"); + public static $ESCAPE_CHARS = array('"', '\\', '/', "b", "f", "n", "r", "t"); public static $ESCAPE_CHAR_VALS = array( - '"', '\\', "\x08", "\f", "\n", "\r", "\t", + '"', '\\', '/', "\x08", "\f", "\n", "\r", "\t", ); const NAME_BOOL = "tf"; -- 2.17.1