Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 335483

Summary: [Discovery][ZooDiscovery] properties should not be transformed by provider
Product: [RT] ECF Reporter: Scott Lewis <slewis>
Component: ecf.discoveryAssignee: 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 CLA 2011-01-26 13:28:37 EST

    
Comment 1 Scott Lewis CLA 2011-01-26 13:41:31 EST
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).
Comment 2 Ahmed Aadel CLA 2011-01-28 04:11:47 EST
(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.
Comment 3 Wim Jongman CLA 2011-02-12 07:07:36 EST
removed code and pushed to master