--- tribes/membership/MemberImpl.java (revision 832495) +++ tribes/membership/MemberImpl.java (working copy) @@ -438,7 +438,7 @@ if (DO_DNS_LOOKUPS) this.hostname = java.net.InetAddress.getByAddress(host).getHostName(); else - this.hostname = org.apache.catalina.tribes.util.Arrays.toString(host); + this.hostname = org.apache.catalina.tribes.util.Arrays.toString(host, true); return this.hostname; }catch ( IOException x ) { throw new RuntimeException("Unable to parse hostname.",x); --- tribes/util/Arrays.java (revision 832495) +++ tribes/util/Arrays.java (working copy) @@ -50,17 +50,32 @@ } return match; } - + public static String toString(byte[] data) { - return toString(data,0,data!=null?data.length:0); + return toString(data, false); } + + public static String toString(byte[] data, boolean unsigned) { + return toString(data, 0, data != null ? data.length : 0, unsigned); + } public static String toString(byte[] data, int offset, int length) { + return toString(data, offset, length, false); + } + + public static String toString(byte[] data, int offset, int length, boolean unsigned) { StringBuffer buf = new StringBuffer("{"); - if ( data != null && length > 0 ) { - buf.append(data[offset++]); - for (int i = offset; i < length; i++) { - buf.append(", ").append(data[i]); + if (data != null && length > 0) { + if (unsigned) { + buf.append(data[offset++] & 0xff); + for (int i = offset; i < length; i++) { + buf.append(", ").append(data[i] & 0xff); + } + } else { + buf.append(data[offset++]); + for (int i = offset; i < length; i++) { + buf.append(", ").append(data[i]); + } } } buf.append("}"); @@ -203,8 +218,6 @@ return result; } - - public static byte[] convert(String s) { try { return s.getBytes("ISO-8859-1"); @@ -213,9 +226,5 @@ return s.getBytes(); } } +} - - - - -}