ASF Bugzilla – Attachment 24467 Details for
Bug 48113
Member hostname components are printed as signed 8bits
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to print hostname IP components as unsigned int
hostname.patch (text/plain), 2.53 KB, created by
Quintin Beukes
on 2009-11-03 10:31:25 UTC
(
hide
)
Description:
Patch to print hostname IP components as unsigned int
Filename:
MIME Type:
Creator:
Quintin Beukes
Created:
2009-11-03 10:31:25 UTC
Size:
2.53 KB
patch
obsolete
>Index: tribes/membership/MemberImpl.java >=================================================================== >--- 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); >Index: tribes/util/Arrays.java >=================================================================== >--- 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(); > } > } >+} > >- >- >- >- >-} >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 48113
: 24467