Bug 48113 - Member hostname components are printed as signed 8bits
Summary: Member hostname components are printed as signed 8bits
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Cluster (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-03 10:31 UTC by Quintin Beukes
Modified: 2009-12-19 14:57 UTC (History)
0 users



Attachments
Patch to print hostname IP components as unsigned int (2.53 KB, patch)
2009-11-03 10:31 UTC, Quintin Beukes
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Quintin Beukes 2009-11-03 10:31:25 UTC
Created attachment 24467 [details]
Patch to print hostname IP components as unsigned int

Hey,

Take the following member for example: 192.168.1.61:4000, when it's hostname is
printed (like in toString()), it shows as: 
tcp://{-64, -88, 1, 61}:4000

Like in:
16:23:17,773 INFO  [TcpFailureDetector] Received
memberDisappeared[org.apache.catalina.tribes.membership.MemberImpl[tcp://{-64,
-88, 1, 61}:4000,{-64, -88, 1, 61},4000, alive=1814258,id={50 18 86 10 111 -47
79 83 -108 -4 82 -8 26 82 -79 -59 }, payload={-84 -19 0 5 115 114 0 50 111
...(423)}, command={}, domain={74 79 84 84 65 95 87 65 68 ...(10)}, ]] message.
Will verify.
16:23:17,897 INFO  [TcpFailureDetector] Verification complete. Member still
alive[org.apache.catalina.tribes.membership.MemberImpl[tcp://{-64, -88, 1,
61}:4000,{-64, -88, 1, 61},4000, alive=1814258,id={50 18 86 10 111 -47 79 83
-108 -4 82 -8 26 82 -79 -59 }, payload={-84 -19 0 5 115 114 0 50 111 ...(423)},
command={}, domain={74 79 84 84 65 95 87 65 68 ...(10)}, ]]

I attached a patch which takes the Arrays.toString(byte[]) and creates another
one with a second argument "unsigned". Then the original delegates to this new
one with a default of "false" for unsigned. So existing code will continue to
behave as is, but the getHostname() code in MemberImpl passes "true" for this
argument, which will make the name print as:
tcp://{192, 168, 1, 61}:4000

So this code updates:
java/org/apache/catalina/tribes/util/Arrays.java
java/org/apache/catalina/tribes/membership/MemberImpl.java

I generated the patch from trunk with a root of:
java/org/apache/catalina/

So it needs to be applied from this directory.
Comment 1 Mark Thomas 2009-11-22 15:14:51 UTC
This was fixed in trunk in r758249. I have proposed the same patch for 6.0.x
Comment 2 Mark Thomas 2009-12-19 14:57:31 UTC
The patch has been applied to 6.0.x and will be included in 6.0.21 onwards.

Many thanks.