| Summary: | Autodiscovery of TCF agents no longer works after upgrading from 0.2.0 to 0.3.0 | ||
|---|---|---|---|
| Product: | [Tools] TCF | Reporter: | Franz Polzer <franz_polzer> |
| Component: | Core | Assignee: | Project Inbox <dsdp.tm.tcf-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | Martin Oberhuber <mober.at+eclipse> |
| Severity: | major | ||
| Priority: | P3 | CC: | cdtdoug, eugene |
| Version: | unspecified | ||
| Target Milestone: | 0.4.0 | ||
| Hardware: | PC | ||
| OS: | Windows Vista | ||
| Whiteboard: | |||
|
Description
Franz Polzer
I cannot reproduce the problem using latest Java code and 0.2.0 agent on Windows. Everything seems to work fine. The problem might be caused by bug 318260: https://bugs.eclipse.org/bugs/show_bug.cgi?id=318260 which was fixed after tag 0.3.0 was created. Could you try the latest Java code to see if the problem will go away? I have tried with the latest code and the problem still exists.
The problem seems to be in the routine that tries to get the network address from the IP-config.
The line
InetAddress addr = map.get(s.substring(n + 3));
in the method
private void getWindowsSubNetList(HashSet<SubNet> set) throws Exception {
fails because at my machine the returned address line from the IPCONFIG output is:
"IPv4-Adresse . . . . . . . . . . : 192.168.1.1(Bevorzugt)"
so s.substring(n + 3) returns
"192.168.1.1(Bevorzugt)"
which is not found in the map of enumerated IP addresses.
I think parsing IP addresses this way is very error-prone because the returned string is language-dependend.
When I completely remove the windows specific part and use the generic enumeration part (with disabled IPv6 on my machine) auto-discovery works fine.
I also tried changing the parsing algorithm to only take an IP-number like text:
String address = s.substring(n + 3);
String address2 = "";
for (int i = 0; i < address.length(); i++) {
char ch = address.charAt(i);
if (!((ch >= '0' && ch <= '9') || ch == '.'))
break;
address2 += ch;
}
InetAddress addr = map.get(address2);
and this also works fine.
After some digging on the net I found that ipconfig on Vista sometimes shows DHCP status after an IP address, a word like Preferred/Deprecated/Invalid. I have committed a fix that only takes an IP-number-like part of the string, as you suggested. Thanks! Moving bugs to new home for IP log. Bulk change: Marking all bugs from the TM era (until June 2011) target 0.3 |