You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jf...@apache.org on 2011/10/07 02:10:21 UTC

svn commit: r1179904 - /thrift/trunk/lib/java/src/org/apache/thrift/protocol/TJSONProtocol.java

Author: jfarrell
Date: Fri Oct  7 00:10:20 2011
New Revision: 1179904

URL: http://svn.apache.org/viewvc?rev=1179904&view=rev
Log:
Thrift-1375: fixed a hex char conversion bug in TJSONProtocol
Client: java
Patch: Dave Watson

Fixed a hex char conversion bug in TJSONProtocol: 10 ~ 15 <=> 'a' ~ 'f'.


Modified:
    thrift/trunk/lib/java/src/org/apache/thrift/protocol/TJSONProtocol.java

Modified: thrift/trunk/lib/java/src/org/apache/thrift/protocol/TJSONProtocol.java
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/java/src/org/apache/thrift/protocol/TJSONProtocol.java?rev=1179904&r1=1179903&r2=1179904&view=diff
==============================================================================
--- thrift/trunk/lib/java/src/org/apache/thrift/protocol/TJSONProtocol.java (original)
+++ thrift/trunk/lib/java/src/org/apache/thrift/protocol/TJSONProtocol.java Fri Oct  7 00:10:20 2011
@@ -331,7 +331,7 @@ public class TJSONProtocol extends TProt
       return (byte)((char)ch - '0');
     }
     else if ((ch >= 'a') && (ch <= 'f')) {
-      return (byte)((char)ch - 'a');
+      return (byte)((char)ch - 'a' + 10);
     }
     else {
       throw new TProtocolException(TProtocolException.INVALID_DATA,
@@ -346,7 +346,7 @@ public class TJSONProtocol extends TProt
       return (byte)((char)val + '0');
     }
     else {
-      return (byte)((char)val + 'a');
+      return (byte)((char)(val - 10) + 'a');
     }
   }