Bug 149220 - Pathmap URI contains non-encoded segments which cause exceptions
Summary: Pathmap URI contains non-encoded segments which cause exceptions
Status: RESOLVED FIXED
Alias: None
Product: GMF-Runtime
Classification: Modeling
Component: General (show other bugs)
Version: 1.0   Edit
Hardware: PC Windows XP
: P3 major
Target Milestone: 1.0.1   Edit
Assignee: Chris McGee CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
: 150521 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-06-29 15:20 EDT by Kevin Cornell CLA
Modified: 2010-07-19 12:25 EDT (History)
1 user (show)

See Also:


Attachments
A small patch to fix pathmap manager encoding problems (1.66 KB, patch)
2006-07-21 10:41 EDT, Chris McGee CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Cornell CLA 2006-06-29 15:20:14 EDT
A UML profile has been registered using a pathmap that is registered as follows:
   <extension
         point="org.eclipse.gmf.runtime.emf.core.Pathmaps">
      <pathmap
            name="PROFILE_PATH"
            plugin="com.xyz.abc"
            path="profiles">
      </pathmap>
   </extension>

When the Eclipse plug-in "com.xyz.abc" is installed in the directory c:\Program Files\MyProduct\eclipse\plugins, the resulting entry in the PathmapManager's PATH_MAP table is as follows:
    key = "PROFILE_PATH"
    value = "c:/Program Files/MyProduct/eclipse/plugins/com.xyz.abc"

The PathmapManager stores this key/value pair in its configure() method. The entries in the PATH_MAP are resolved and added to the map by the following code: 
	URL url = bundle.getEntry(path);
	if (url == null)
		continue;
	try {
		url = FileLocator.resolve(url);
		if (url == null)
			continue;
		paths.put(var, url.toString());

The URL returned from FileLocator.resolve() is not encoded (e.g., c:/Program Files/... instead of c:/Program%20Files/...) and when a URI converter tries to normalize a profile URI that uses a pathmap, the resulting URI is also not encoded. When an attempt is made to resolve the profile URI, the code in org.eclipse.gmf.runtime.emf.core.internal.util.Util.denormalizeURI(...), takes the normalized uri.toString() value and passes it to java.net.URI.create(String uri), which throws an exception. This exception prevents the profile from being resolved.

According to the Eclipse FileLocator.resolve() documentation, the returned URL does not have to be encoded but when that pathmap value is used in URI's, it may need to be encoded.
Comment 1 Christian Damus CLA 2006-07-17 13:46:12 EDT
Is this problem related to Bug 150521?
Comment 2 Chris McGee CLA 2006-07-17 14:58:20 EDT
*** Bug 150521 has been marked as a duplicate of this bug. ***
Comment 3 Chris McGee CLA 2006-07-21 10:41:36 EDT
Created attachment 46639 [details]
A small patch to fix pathmap manager encoding problems
Comment 4 Linda Damus CLA 2006-07-24 09:46:38 EDT
Reviewed and committed the patch.

CVS change set: [149220] gmf_R1_0_maintenance cbmcgee 060724 Pathmap URI contains non-encoded segments which cause exceptions
Comment 5 Linda Damus CLA 2006-07-25 15:18:50 EDT
Reviewed and committed the patch.
Comment 6 Eclipse Webmaster CLA 2010-07-19 12:25:04 EDT
[GMF Restructure] Bug 319140 : product GMF and component
Runtime EMF was the original product and component for this bug