From: Bryan Duxbury Date: Mon, 28 Dec 2009 18:49:03 +0000 (+0000) Subject: (no ticket). java: Make Unions print binary values more tersely X-Git-Tag: 0.3.0~148 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=d250314e66b5a90b4aa5060ee1e326b5818cbb46;p=common%2Fthrift.git (no ticket). java: Make Unions print binary values more tersely 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 --- diff --git a/lib/java/src/org/apache/thrift/TUnion.java b/lib/java/src/org/apache/thrift/TUnion.java index 7e4f0afc..353e11c9 100644 --- a/lib/java/src/org/apache/thrift/TUnion.java +++ b/lib/java/src/org/apache/thrift/TUnion.java @@ -212,7 +212,7 @@ public abstract class TUnion implements TBase { 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) {