Chae Lee created THRIFT-4003: -------------------------------- Summary: Is there a reason why hexVal() in TJSONProtocol.java throws exception when uppercase alphabet is given? Key: THRIFT-4003 URL: https://issues.apache.org/jira/browse/THRIFT-4003 Project: Thrift Issue Type: Question Components: Java - Compiler, Java - Library Reporter: Chae Lee Priority: Trivial
Found out that passing unicode string "\uB300\uCE58" to Java server causes "Expected hex character" in lib/java/src/protocol/TJSONProtocol.java:306. {code:title=TJSONProtocol.java|borderStyle=solid} // Convert a byte containing a hex char ('0'-'9' or 'a'-'f') into its // corresponding hex value private static final byte hexVal(byte ch) throws TException { if ((ch >= '0') && (ch <= '9')) { return (byte)((char)ch - '0'); } else if ((ch >= 'a') && (ch <= 'f')) { return (byte)((char)ch - 'a'); } else { throw new TProtocolException(TProtocolException.INVALID_DATA, "Expected hex character"); } }{code} This is due to alphabet 'B' is not between '0' ~ '9' or 'a' ~ 'f'. Not that it's causing major issues or anything, just curious if the if~ else conditionals are set like this for a reason. -- This message was sent by Atlassian JIRA (v6.3.4#6332)