Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 335483 - [Discovery][ZooDiscovery] properties should not be transformed by provider
Summary: [Discovery][ZooDiscovery] properties should not be transformed by provider
Status: RESOLVED FIXED
Alias: None
Product: ECF
Classification: RT
Component: ecf.discovery (show other bugs)
Version: 3.4.0   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.5.0   Edit
Assignee: ecf.core-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 324215
  Show dependency tree
 
Reported: 2011-01-26 13:28 EST by Scott Lewis CLA
Modified: 2011-02-12 07:07 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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