Community
Participate
Working Groups
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