thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Krutsko (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (THRIFT-4408) Some unicode characters can't be parsed with Thrift Java
Date Wed, 13 Dec 2017 18:57:00 GMT

    [ https://issues.apache.org/jira/browse/THRIFT-4408?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16289719#comment-16289719
] 

Sergey Krutsko commented on THRIFT-4408:
----------------------------------------

I didn't notice thrift-0.11.0 release. But, it is reproducible 0.11.0 and master.

> Some unicode characters can't be parsed with Thrift Java
> --------------------------------------------------------
>
>                 Key: THRIFT-4408
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4408
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Compiler
>    Affects Versions: 0.10.0
>            Reporter: Sergey Krutsko
>         Attachments: thrift_unicode_patch.patch
>
>
> If string field of thrift object contains character 
> < 
> encoded as "\uff1c then parser can't parse such object at all and fails with: 
> {code}
> java.lang.IllegalArgumentException: -228
> 	at java.lang.String.<init>(String.java:266)
> 	at org.apache.thrift.protocol.TJSONProtocol.readJSONString(TJSONProtocol.java:691)
> {code}
> Here the unit test to reproduce it:
> {code}
> @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());
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message