THRIFT-2285 TJsonProtocol implementation for Java/JavaMe/PHP doesn't allow a slash (/) to be escaped (\/)
Patch: Jens Geyer
diff --git a/lib/java/src/org/apache/thrift/protocol/TJSONProtocol.java b/lib/java/src/org/apache/thrift/protocol/TJSONProtocol.java
index f07a4a7..02f36e3 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 @@
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 fd92d45..de7086f 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 @@
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 3d39583..402401a 100644
--- a/lib/php/lib/Thrift/Protocol/TJSONProtocol.php
+++ b/lib/php/lib/Thrift/Protocol/TJSONProtocol.php
@@ -57,10 +57,10 @@
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";