thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Krutsko (JIRA)" <>
Subject [jira] [Created] (THRIFT-4408) Some unicode characters can't be parsed with Thrift Java
Date Tue, 05 Dec 2017 13:45:00 GMT
Sergey Krutsko created THRIFT-4408:

             Summary: Some unicode characters can't be parsed with Thrift Java
                 Key: THRIFT-4408
             Project: Thrift
          Issue Type: Bug
          Components: Java - Compiler
    Affects Versions: 0.10.0
            Reporter: Sergey Krutsko
            Priority: Minor

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>(
	at org.apache.thrift.protocol.TJSONProtocol.readJSONString(

Here the unit test to reproduce it:
    public void readUnicode_uff1c() throws Exception {
        String jsonEncodedEntity = "{\"1\":{\"str\":\"\\uff1c\"}}";
        byte[] bytesEntity = jsonEncodedEntity.getBytes();

        TMemoryBuffer memoryBuffer = new TMemoryBuffer(bytesEntity.length);

        TJSONProtocol protocol = new TJSONProtocol(memoryBuffer);
        assertEquals("<", protocol.readString());

This message was sent by Atlassian JIRA

View raw message