| Summary: | [Discovery][ZooDiscovery] properties should not be transformed by provider | ||
|---|---|---|---|
| Product: | [RT] ECF | Reporter: | Scott Lewis <slewis> |
| Component: | ecf.discovery | Assignee: | ecf.core-inbox <ecf.core-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | major | ||
| Priority: | P3 | CC: | ahmed.aadel, bugs.eclipse.org, wim.jongman |
| Version: | 3.4.0 | ||
| Target Milestone: | 3.5.0 | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
| Bug Depends on: | |||
| Bug Blocks: | 324215 | ||
|
Description
Scott Lewis
In the zookeeper AdvertisedService two constructors have code like this:
if (value instanceof String && ((String) value).contains("localhost")) {
this.internalProperties.put(k, ((String) value).replace(
"localhost",//$NON-NLS-1$
Geo.getHost()));
continue;
}
This transforms the value of discovery properties...replacing 'localhost' with a a value returned from Geo.getHost().
Changing the value of a property violates the contract of the discovery API and can/could create unpredictable behavior for discovery receivers. For example, this can/is problematic when a string value that has an embedded 'localhost' is *intended* to be delivered intact to receivers of the service discovery...i.e. the receiver will read the property value and it will be incorrect (not what the sender actually sent).
(In reply to comment #1) > In the zookeeper AdvertisedService two constructors have code like this: > > if (value instanceof String && ((String) value).contains("localhost")) { > this.internalProperties.put(k, ((String) value).replace( > "localhost",//$NON-NLS-1$ > Geo.getHost())); > continue; > } > > This transforms the value of discovery properties...replacing 'localhost' with > a a value returned from Geo.getHost(). > > Changing the value of a property violates the contract of the discovery API and > can/could create unpredictable behavior for discovery receivers. For example, > this can/is problematic when a string value that has an embedded 'localhost' is > *intended* to be delivered intact to receivers of the service discovery...i.e. > the receiver will read the property value and it will be incorrect (not what > the sender actually sent). Agree. This whole 'if' check clause may be omitted. removed code and pushed to master |