[373565] Do not use fragments when resolving URI from component in MappedComponentXMIHelper
diff --git a/features/org.eclipse.wst.common_core.feature.patch/buildnotes_org.eclipse.wst.common_core.feature.patch.html b/features/org.eclipse.wst.common_core.feature.patch/buildnotes_org.eclipse.wst.common_core.feature.patch.html
index 680a585..dbb941d 100644
--- a/features/org.eclipse.wst.common_core.feature.patch/buildnotes_org.eclipse.wst.common_core.feature.patch.html
+++ b/features/org.eclipse.wst.common_core.feature.patch/buildnotes_org.eclipse.wst.common_core.feature.patch.html
@@ -14,6 +14,7 @@
 <h2>org.eclipse.wst.common_core.feature</h2>
 
 <p>Bug <a href='https://bugs.eclipse.org/373416'>373416</a>. Remove reference to JBoss</p>
+<p>Bug <a href='https://bugs.eclipse.org/373565'>373565</a>. Do not use fragments when resolving URI from component in MappedComponentXMIHelper</p>
 <p>Bug <a href='https://bugs.eclipse.org/373570'>373570</a>. V2 Validation Framework ignoring IResourceDelta.REMOVED events</p>
 
 </body>
diff --git a/features/org.eclipse.wst.common_core.feature.patch/feature.properties b/features/org.eclipse.wst.common_core.feature.patch/feature.properties
index 9e971f6..c718a68 100644
--- a/features/org.eclipse.wst.common_core.feature.patch/feature.properties
+++ b/features/org.eclipse.wst.common_core.feature.patch/feature.properties
@@ -28,6 +28,7 @@
 Contains fixes described in the following bugzilla(s):\n\
 \n\
 Bug https://bugs.eclipse.org/373416 Remove reference to JBoss\n\
+Bug https://bugs.eclipse.org/373565 Do not use fragments when resolving URI from component in MappedComponentXMIHelper\n\
 Bug https://bugs.eclipse.org/373570 V2 Validation Framework ignoring IResourceDelta.REMOVED events\n\
 \n\
 # "copyright" property - text of the "Feature Update Copyright"
diff --git a/features/org.eclipse.wst.common_core.feature.patch/feature.xml b/features/org.eclipse.wst.common_core.feature.patch/feature.xml
index 33c8d79..40b64fa 100644
--- a/features/org.eclipse.wst.common_core.feature.patch/feature.xml
+++ b/features/org.eclipse.wst.common_core.feature.patch/feature.xml
@@ -21,6 +21,12 @@
       <import feature="org.eclipse.wst.common_core.feature" version="3.3.2.v201111030500-7B7DFO9F7RZHOhIjR6Mz-NJ" patch="true"/>
    </requires>
 
+   <plugin
+         id="org.eclipse.wst.common.modulecore"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
 
    <plugin
          id="org.eclipse.wst.validation"
diff --git a/plugins/org.eclipse.wst.common.modulecore/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.common.modulecore/META-INF/MANIFEST.MF
index e426e65..56bd3c0 100644
--- a/plugins/org.eclipse.wst.common.modulecore/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.common.modulecore/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@
 Bundle-Name: %Bundle-Name.0
 Bundle-Vendor: %provider
 Bundle-SymbolicName: org.eclipse.wst.common.modulecore; singleton:=true
-Bundle-Version: 1.2.103.qualifier
+Bundle-Version: 1.2.104.qualifier
 Bundle-Activator: org.eclipse.wst.common.componentcore.internal.ModulecorePlugin
 Bundle-Localization: plugin
 Export-Package: org.eclipse.wst.common.componentcore,
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/MappedComponentXMIHelper.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/MappedComponentXMIHelper.java
index 250ccb7..613bca6 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/MappedComponentXMIHelper.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/MappedComponentXMIHelper.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
+ * Copyright (c) 2005, 2012 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -58,11 +58,20 @@
 	private URI resolveURIFromComponent(URI relative, URI base) {
 		IVirtualComponent component = getComponent(base);
 		if (component != null) {
-			IVirtualFile virtualFile = component.getRootFolder().getFile(new Path(relative.toString()));
+			// If the relative URI has a fragment, remove it before resolving. 
+			boolean hasFragment = relative.hasFragment();
+			URI tmpURI = hasFragment?relative.trimFragment():relative;
+			IVirtualFile virtualFile = component.getRootFolder().getFile(new Path(tmpURI.toString()));
 			if (virtualFile != null) {
 				IPath resolvingPath = virtualFile.getWorkspaceRelativePath();
-				if (resolvingPath !=null) 
-					return URI.createPlatformResourceURI(resolvingPath.toString());
+				if (resolvingPath !=null) {
+					URI result = URI.createPlatformResourceURI(resolvingPath.toString());
+					// If the original URI had a fragment, add the fragment to the result.
+					if (hasFragment){
+						result = result.appendFragment(relative.fragment());
+					}
+					return result;
+				}
 			}
 		}
 		return null;