Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2008-05-14 01:54:53 -0400
committerslewis2008-05-14 01:54:53 -0400
commit5fdb8c1f09b293e1a9836ab39903a91ec5cdd774 (patch)
treec21720a8e8564b4b9ae94fc2f12e9fff07de8b17
parent96a52412c2b10b101766d0ba53369b1ce1f6db09 (diff)
downloadorg.eclipse.ecf-5fdb8c1f09b293e1a9836ab39903a91ec5cdd774.tar.gz
org.eclipse.ecf-5fdb8c1f09b293e1a9836ab39903a91ec5cdd774.tar.xz
org.eclipse.ecf-5fdb8c1f09b293e1a9836ab39903a91ec5cdd774.zip
Fix for 231969
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/provider/filetransfer/identity/FileTransferID.java4
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/provider/filetransfer/identity/FileTransferNamespace.java37
2 files changed, 24 insertions, 17 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/provider/filetransfer/identity/FileTransferID.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/provider/filetransfer/identity/FileTransferID.java
index 9d4cb298d..378c1f370 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/provider/filetransfer/identity/FileTransferID.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/provider/filetransfer/identity/FileTransferID.java
@@ -11,7 +11,6 @@
package org.eclipse.ecf.provider.filetransfer.identity;
import java.net.URL;
-
import org.eclipse.core.runtime.Assert;
import org.eclipse.ecf.core.identity.BaseID;
import org.eclipse.ecf.core.identity.Namespace;
@@ -31,8 +30,7 @@ public class FileTransferID extends BaseID implements IFileID {
}
protected int namespaceCompareTo(BaseID o) {
- return this.fileURL.toExternalForm().compareTo(
- ((FileTransferID) o).toExternalForm());
+ return this.fileURL.toExternalForm().compareTo(((FileTransferID) o).toExternalForm());
}
protected boolean namespaceEquals(BaseID o) {
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/provider/filetransfer/identity/FileTransferNamespace.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/provider/filetransfer/identity/FileTransferNamespace.java
index 899f614b0..3ee3e77b0 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/provider/filetransfer/identity/FileTransferNamespace.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/provider/filetransfer/identity/FileTransferNamespace.java
@@ -11,10 +11,7 @@ package org.eclipse.ecf.provider.filetransfer.identity;
import java.net.URL;
import java.util.HashSet;
import java.util.Set;
-
-import org.eclipse.ecf.core.identity.ID;
-import org.eclipse.ecf.core.identity.IDCreateException;
-import org.eclipse.ecf.core.identity.Namespace;
+import org.eclipse.ecf.core.identity.*;
import org.eclipse.ecf.internal.provider.filetransfer.Activator;
import org.eclipse.ecf.internal.provider.filetransfer.Messages;
@@ -28,26 +25,39 @@ public class FileTransferNamespace extends Namespace {
public static final String PROTOCOL = Messages.FileTransferNamespace_Namespace_Protocol;
+ 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;
+ }
+
/*
* (non-Javadoc)
*
* @see org.eclipse.ecf.core.identity.Namespace#createInstance(java.lang.Object[])
*/
public ID createInstance(Object[] args) throws IDCreateException {
- if (args == null || args.length == 0)
- throw new IDCreateException(
- Messages.FileTransferNamespace_Exception_Args_Null);
try {
+ String init = getInitFromExternalForm(args);
+ if (init != null)
+ return new FileTransferID(this, new URL(init));
if (args[0] instanceof URL)
return new FileTransferID(this, (URL) args[0]);
if (args[0] instanceof String)
return new FileTransferID(this, new URL((String) args[0]));
} catch (Exception e) {
- throw new IDCreateException(
- Messages.FileTransferNamespace_Exception_Create_Instance, e);
+ throw new IDCreateException(Messages.FileTransferNamespace_Exception_Create_Instance, e);
}
- throw new IDCreateException(
- Messages.FileTransferNamespace_Exception_Create_Instance_Failed);
+ throw new IDCreateException(Messages.FileTransferNamespace_Exception_Create_Instance_Failed);
}
/*
@@ -57,8 +67,7 @@ public class FileTransferNamespace extends Namespace {
*/
public String[] getSupportedSchemes() {
Set result = new HashSet();
- String[] platformSchemes = Activator.getDefault()
- .getPlatformSupportedSchemes();
+ String[] platformSchemes = Activator.getDefault().getPlatformSupportedSchemes();
for (int i = 0; i < platformSchemes.length; i++)
result.add(platformSchemes[i]);
return (String[]) result.toArray(new String[] {});
@@ -79,7 +88,7 @@ public class FileTransferNamespace extends Namespace {
* @see org.eclipse.ecf.core.identity.Namespace#getSupportedParameterTypesForCreateInstance()
*/
public Class[][] getSupportedParameterTypes() {
- return new Class[][] { { URL.class }, { String.class } };
+ return new Class[][] { {URL.class}, {String.class}};
}
}

Back to the top