Fix (added system property) to address bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=463008
Change-Id: Ie279aad5eadcaea8dca093b6fab0359821f079de
diff --git a/providers/bundles/org.eclipse.ecf.provider.r_osgi/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.r_osgi/META-INF/MANIFEST.MF
index c952eef..21f75b9 100644
--- a/providers/bundles/org.eclipse.ecf.provider.r_osgi/META-INF/MANIFEST.MF
+++ b/providers/bundles/org.eclipse.ecf.provider.r_osgi/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.ecf.provider.r_osgi;singleton:=true
-Bundle-Version: 3.5.0.qualifier
+Bundle-Version: 3.5.100.qualifier
Import-Package: org.eclipse.ecf.core.util.reflection,
org.eclipse.ecf.remoteservice.asyncproxy;version="1.0.0",
org.eclipse.equinox.concurrent.future;version="1.0.0",
diff --git a/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/R_OSGiContainerInstantiator.java b/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/R_OSGiContainerInstantiator.java
index 89e9e70..73ecfe5 100644
--- a/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/R_OSGiContainerInstantiator.java
+++ b/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/R_OSGiContainerInstantiator.java
@@ -44,6 +44,8 @@
private static final int WS_DEFAULT_PORT = 80;
private static final int WSS_DEFAULT_PORT = 443;
+ final boolean useHostname = Boolean.valueOf(System.getProperty("org.eclipse.ecf.provider.r_osgi.useHostName", "true")).booleanValue(); //$NON-NLS-1$ //$NON-NLS-2$
+
/**
* creates a new container instance.
*
@@ -64,8 +66,14 @@
Namespace ns = (wss ? R_OSGiWSSNamespace.getDefault() : ((ws) ? R_OSGiWSNamespace.getDefault() : R_OSGiNamespace.getDefault()));
ID containerID = null;
if (parameters == null) {
- //TODO factor localHost and protocol out?
- final String localHost = InetAddress.getLocalHost().getCanonicalHostName();
+ String localHost = null;
+ if (useHostname) {
+ try {
+ localHost = InetAddress.getLocalHost().getCanonicalHostName();
+ } catch (UnknownHostException e) {
+ localHost = "localhost"; //$NON-NLS-1$
+ }
+ }
final String nsScheme = ns.getScheme();
final String wsProtocol = (wss ? WSS_PROTOCOL : (ws ? WS_PROTOCOL : null));
int listeningPort = remoteOSGiService.getListeningPort((wsProtocol != null) ? wsProtocol : nsScheme);
@@ -100,8 +108,6 @@
return new R_OSGiRemoteServiceContainer(remoteOSGiService, containerID);
} catch (IDCreateException e) {
throw new ContainerCreateException("Could not create R_OSGI ID", e); //$NON-NLS-1$
- } catch (UnknownHostException e) {
- throw new ContainerCreateException("Could not get localhost canonical host name", e); //$NON-NLS-1$
}
}