Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
0.10.0, 0.11.0
-
None
-
None
-
Patch Available
Description
If string field of thrift object contains character
<
encoded as "\uff1c then parser can't parse such object at all and fails with:
java.lang.IllegalArgumentException: -228 at java.lang.String.<init>(String.java:266) at org.apache.thrift.protocol.TJSONProtocol.readJSONString(TJSONProtocol.java:691)
Here the unit test to reproduce it:
@Test public void readUnicode_uff1c() throws Exception { String jsonEncodedEntity = "{\"1\":{\"str\":\"\\uff1c\"}}"; byte[] bytesEntity = jsonEncodedEntity.getBytes(); TMemoryBuffer memoryBuffer = new TMemoryBuffer(bytesEntity.length); memoryBuffer.write(bytesEntity); memoryBuffer.close(); TJSONProtocol protocol = new TJSONProtocol(memoryBuffer); protocol.readStructBegin(); protocol.readFieldBegin(); assertEquals("<", protocol.readString()); }