Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2008-05-14 05:54:52 +0000
committerslewis2008-05-14 05:54:52 +0000
commit96a52412c2b10b101766d0ba53369b1ce1f6db09 (patch)
treef4a222b875c73441a2ab358147e04466154a7ae8 /providers
parent1792121f81f14c634f5d87be4405bb611112d132 (diff)
downloadorg.eclipse.ecf-96a52412c2b10b101766d0ba53369b1ce1f6db09.tar.gz
org.eclipse.ecf-96a52412c2b10b101766d0ba53369b1ce1f6db09.tar.xz
org.eclipse.ecf-96a52412c2b10b101766d0ba53369b1ce1f6db09.zip
Fix for 231969
Diffstat (limited to 'providers')
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/provider/r_osgi/identity/R_OSGiID.java2
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/provider/r_osgi/identity/R_OSGiNamespace.java27
2 files changed, 24 insertions, 5 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/provider/r_osgi/identity/R_OSGiID.java b/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/provider/r_osgi/identity/R_OSGiID.java
index 2afb03c1a..a327a25ae 100644
--- a/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/provider/r_osgi/identity/R_OSGiID.java
+++ b/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/provider/r_osgi/identity/R_OSGiID.java
@@ -11,8 +11,8 @@
package org.eclipse.ecf.provider.r_osgi.identity;
-import org.eclipse.ecf.core.identity.BaseID;
import ch.ethz.iks.r_osgi.URI;
+import org.eclipse.ecf.core.identity.BaseID;
/**
* The ID implementation of R-OSGi URIs. Currently only works with the R-OSGi
diff --git a/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/provider/r_osgi/identity/R_OSGiNamespace.java b/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/provider/r_osgi/identity/R_OSGiNamespace.java
index 6e9416715..972cb871b 100644
--- a/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/provider/r_osgi/identity/R_OSGiNamespace.java
+++ b/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/provider/r_osgi/identity/R_OSGiNamespace.java
@@ -11,8 +11,8 @@
package org.eclipse.ecf.provider.r_osgi.identity;
-import java.util.Arrays;
import org.eclipse.ecf.core.identity.*;
+import org.eclipse.osgi.util.NLS;
/**
* The R-OSGi default transport namespace (r-osgi://).
@@ -56,6 +56,21 @@ public class R_OSGiNamespace extends Namespace {
instance = this;
}
+ private String getInitFromExternalForm(Object[] args) {
+ if (args == null || args.length < 1 || args[0] == null)
+ return null;
+ if (args[0] instanceof String) {
+ String arg = (String) args[0];
+ if (arg.startsWith(getScheme() + Namespace.SCHEME_SEPARATOR)) {
+ int index = arg.indexOf(Namespace.SCHEME_SEPARATOR);
+ if (index >= arg.length())
+ return null;
+ return arg.substring(index + 1);
+ }
+ }
+ return null;
+ }
+
/**
* create a new ID within this namespace.
*
@@ -67,10 +82,14 @@ public class R_OSGiNamespace extends Namespace {
* @see org.eclipse.ecf.core.identity.Namespace#createInstance(java.lang.Object[])
*/
public ID createInstance(final Object[] parameters) throws IDCreateException {
- if (parameters == null || parameters.length != 1 || !(parameters[0] instanceof String)) {
- throw new IDCreateException("Cannot create ID from " + (parameters == null ? "null" : Arrays.asList(parameters).toString())); //$NON-NLS-1$ //$NON-NLS-2$
+ try {
+ String init = getInitFromExternalForm(parameters);
+ if (init != null)
+ return new R_OSGiID(init);
+ return new R_OSGiID((String) parameters[0]);
+ } catch (Exception e) {
+ throw new IDCreateException(NLS.bind("{0} createInstance()", getName()), e); //$NON-NLS-1$
}
- return new R_OSGiID((String) parameters[0]);
}
/**

Back to the top