(no ticket). java: Make Unions print binary values more tersely
authorBryan Duxbury <bryanduxbury@apache.org>
Mon, 28 Dec 2009 18:49:03 +0000 (18:49 +0000)
committerBryan Duxbury <bryanduxbury@apache.org>
Mon, 28 Dec 2009 18:49:03 +0000 (18:49 +0000)
Bytes were getting sign-extended out into giant strings of f's. This change makes sure only the bottom byte is used.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@894222 13f79535-47bb-0310-9956-ffa450edef68

lib/java/src/org/apache/thrift/TUnion.java

index 7e4f0af..353e11c 100644 (file)
@@ -212,7 +212,7 @@ public abstract class TUnion<F extends TFieldIdEnum> implements TBase<F> {
       if (i != 0) {
         sb.append(" ");
       }
-      String digit = Integer.toHexString(bytes[i]);
+      String digit = Integer.toHexString(bytes[i] & 0xFF);
       sb.append(digit.length() > 1 ? digit : "0" + digit);
     }
     if (bytes.length > 128) {