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

Bug 349550

Summary: R-OSGi needs to generate URLs with full host name, not just name
Product: [RT] ECF Reporter: Alex Blewitt <alex.blewitt>
Component: ecf.protocolsAssignee: Markus Kuppe <bugs.eclipse.org>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: bugs.eclipse.org, wayne.beaton
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch for bf9f2f21e4576a763da9d4e5da7b1704b4c705c7
none
mylyn/context/zip none

Description Alex Blewitt CLA 2011-06-16 08:01:43 EDT
The R-OSGi provider generates URLs like:

r-osgi://host:9280#1_2.3.4

However, it really should use the canonical host name e.g.

r-osgi://host.example.com:9280#1_2.3.4

since 'host' may not be resolvable by other machines on different DNS subdomain setups.
Comment 1 Alex Blewitt CLA 2011-06-16 08:07:52 EDT
The problem is at R_OSGiContainerInstantiator.java, line 53 (or thereabouts)

			if (parameters == null) {
				//TODO factor localHost and protocol out?
				final String localHost = InetAddress.getLocalHost().getHostName();
				final String protocol = "r-osgi"; //$NON-NLS-1$

				final int port = remoteOsGiService.getListeningPort(protocol);
				final ID containerID = new R_OSGiID(protocol + "://" + localHost + ":" + port); //$NON-NLS-1$ //$NON-NLS-2$
				return new R_OSGiRemoteServiceContainer(remoteOsGiService, containerID);

This should be:

				final String localHost = InetAddress.getLocalHost().getCanonicalHostName()

I'd suggest refactoring 'localHost' to 'hostName' though, and whilst you're there, you might want to recapitalise the 's' in remoteOsGiService ...
Comment 2 Alex Blewitt CLA 2011-06-17 16:52:54 EDT
Proposed patch available at:

https://github.com/alblue/ecf/tree/bug349550
Comment 3 Alex Blewitt CLA 2011-06-17 16:57:51 EDT
Created attachment 198216 [details]
Patch for bf9f2f21e4576a763da9d4e5da7b1704b4c705c7
Comment 4 Markus Kuppe CLA 2011-06-18 11:00:53 EDT
According to [0] 4.) you will have to provide a stmt that the code belongs to you. %)

Since the patch is trivial, I assume 4.) isn't really necessary though and move ahead with merging.

Markus

[0] http://wiki.eclipse.org/Development_Resources/Handling_Git_Contributions
Comment 6 Markus Kuppe CLA 2011-06-18 13:04:18 EDT
Created attachment 198226 [details]
mylyn/context/zip
Comment 7 Wayne Beaton CLA 2014-02-18 14:56:49 EST
I've removed the redundant IPLog+ flag; the contribution is recorded by Git.