Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349550 - R-OSGi needs to generate URLs with full host name, not just name
Summary: R-OSGi needs to generate URLs with full host name, not just name
Status: RESOLVED FIXED
Alias: None
Product: ECF
Classification: RT
Component: ecf.protocols (show other bugs)
Version: unspecified   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Markus Kuppe CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-16 08:01 EDT by Alex Blewitt CLA
Modified: 2014-02-18 14:56 EST (History)
2 users (show)

See Also:


Attachments
Patch for bf9f2f21e4576a763da9d4e5da7b1704b4c705c7 (2.41 KB, patch)
2011-06-17 16:57 EDT, Alex Blewitt CLA
no flags Details | Diff
mylyn/context/zip (1.34 KB, application/octet-stream)
2011-06-18 13:04 EDT, Markus Kuppe CLA
no flags Details

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