Bug 316932 - [sfs] Implement ability to dynamically assign federated content providers
diff --git a/bundles/org.eclipse.core.resources.semantic/src/org/eclipse/core/internal/resources/semantic/SemanticFileStore.java b/bundles/org.eclipse.core.resources.semantic/src/org/eclipse/core/internal/resources/semantic/SemanticFileStore.java
index f0ee5b7..b199e9c 100644
--- a/bundles/org.eclipse.core.resources.semantic/src/org/eclipse/core/internal/resources/semantic/SemanticFileStore.java
+++ b/bundles/org.eclipse.core.resources.semantic/src/org/eclipse/core/internal/resources/semantic/SemanticFileStore.java
@@ -248,14 +248,14 @@
 			if (info != null) {
 				if (info.contentProviderID == null) {
 					throw new SemanticResourceException(SemanticResourceStatusCode.FEDERATION_EMPTY_FEDERATED_PROVIDER_ID, path, NLS.bind(
-							Messages.SemanticFileStore_FederatingContentProviderReturnedNull_XMSG, parentProvider.getClass().getName(), path
-									.toString()));
+							Messages.SemanticFileStore_FederatingContentProviderReturnedNull_XMSG, parentProvider.getClass().getName(),
+							path.toString()));
 				}
 
-				if (info.rootNodePosition <= 0 && info.rootNodePosition > relativePathLength) {
+				if (info.rootNodePosition <= 0 || info.rootNodePosition > relativePathLength) {
 					throw new SemanticResourceException(SemanticResourceStatusCode.FEDERATION_INVALID_ROOT_NODE_POSITION, path, NLS.bind(
-							Messages.SemanticFileStore_FederatingContentProviderReturnedInvalidRootNodePosition_XMSG, parentProvider.getClass()
-									.getName(), path.toString()));
+							Messages.SemanticFileStore_FederatingContentProviderReturnedInvalidRootNodePosition_XMSG, parentProvider
+									.getClass().getName(), path.toString()));
 				}
 
 				ResourceTreeNode parent = node;
diff --git a/bundles/org.eclipse.core.resources.semantic/src/org/eclipse/core/resources/semantic/spi/ISemanticContentProviderFederation2.java b/bundles/org.eclipse.core.resources.semantic/src/org/eclipse/core/resources/semantic/spi/ISemanticContentProviderFederation2.java
index ae4436c..c99bf47 100644
--- a/bundles/org.eclipse.core.resources.semantic/src/org/eclipse/core/resources/semantic/spi/ISemanticContentProviderFederation2.java
+++ b/bundles/org.eclipse.core.resources.semantic/src/org/eclipse/core/resources/semantic/spi/ISemanticContentProviderFederation2.java
@@ -71,18 +71,18 @@
 	 * data may result in unpredictable failures.
 	 * <p>
 	 * Example: Given the root path of this provider at /a/b and the federated
-	 * providers "hugo" and "felix" that should be rooted at /a/b/c/d and
-	 * /a/b/c1 respectively , the method should return following values for
-	 * following inputs:
+	 * providers "foo" and "bar" that should be rooted at /a/b/c/d and /a/b/c1
+	 * respectively , the method should return following values for following
+	 * inputs:
 	 * 
 	 * <pre>
 	 *  /a/b		null
 	 *  /a/b/c 		null
-	 *  /a/b/c/d	{ "hugo", 2 }
-	 *  /a/b/c/d/e	{ "hugo", 2 }
-	 *  /a/b/c1 	{ "felix", 1 }
-	 *  /a/b/c1/d 	{ "felix", 1 }
-	 *  /a/b/c1/d/e	{ "felix", 1 }
+	 *  /a/b/c/d	{ "foo", 2 }
+	 *  /a/b/c/d/e	{ "foo", 2 }
+	 *  /a/b/c1 	{ "bar", 1 }
+	 *  /a/b/c1/d 	{ "bar", 1 }
+	 *  /a/b/c1/d/e	{ "bar", 1 }
 	 *  /a/b/c2 	null
 	 *  /a/b/c3 	null 
 	 *  ...		...
@@ -99,13 +99,13 @@
 	 * 	}
 	 * 
 	 * 	if (checkPath.segment(0).equals(&quot;c1&quot;)) {
-	 * 		return new FederatedProviderInfo(&quot;felix&quot;, 1);
+	 * 		return new FederatedProviderInfo(&quot;bar&quot;, 1);
 	 * 	}
 	 * 
 	 * 	if (checkPath.segmentCount() &gt;= 2) {
 	 * 		if (checkPath.segment(0).equals(&quot;c&quot;)) {
 	 * 			if (checkPath.segment(1).equals(&quot;d&quot;)) {
-	 * 				return new FederatedProviderInfo(&quot;hugo&quot;, 2);
+	 * 				return new FederatedProviderInfo(&quot;foo&quot;, 2);
 	 * 			}
 	 * 		}
 	 * 	}