diff options
author | mkuppe | 2010-10-02 09:57:21 +0000 |
---|---|---|
committer | mkuppe | 2010-10-02 09:57:21 +0000 |
commit | a55710d645ffd663fc21a30f3077cbf463f454c5 (patch) | |
tree | c877f6a4ffe6ea22ee59e61c93050b71c222bafc /compendium | |
parent | 290e5b3789d425f7141e760cb44352cd8dbf2376 (diff) | |
download | org.eclipse.ecf-a55710d645ffd663fc21a30f3077cbf463f454c5.tar.gz org.eclipse.ecf-a55710d645ffd663fc21a30f3077cbf463f454c5.tar.xz org.eclipse.ecf-a55710d645ffd663fc21a30f3077cbf463f454c5.zip |
RESOLVED - bug 326833: [RemoteService][Discovery] ServicePublicationHandler overwrites host name even if URI sets it explicitly
https://bugs.eclipse.org/bugs/show_bug.cgi?id=326833
Diffstat (limited to 'compendium')
-rw-r--r-- | compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/ServicePublicationHandler.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/ServicePublicationHandler.java b/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/ServicePublicationHandler.java index ebed8e607..b9a8517fd 100644 --- a/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/ServicePublicationHandler.java +++ b/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/ServicePublicationHandler.java @@ -423,10 +423,16 @@ public class ServicePublicationHandler implements ServiceTrackerCustomizer, port = 32565; } String host = null; - try { - host = InetAddress.getLocalHost().getHostAddress(); - } catch (Exception e) { - host = "localhost"; //$NON-NLS-1$ + if (uri != null) { + host = uri.getHost(); + } else { + try { + host = InetAddress.getLocalHost().getHostAddress(); + } catch (Exception e) { + logInfo("createURI", //$NON-NLS-1$ + "failed to get local host adress, falling back to \'localhost\'.", e); //$NON-NLS-1$ + host = "localhost"; //$NON-NLS-1$ + } } return new URI(scheme, null, host, port, path, null, null); } |