Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 175436 - Unable to specify osgi.config.area using symbolic location (such as @user.home)
Summary: Unable to specify osgi.config.area using symbolic location (such as @user.home)
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Framework (show other bugs)
Version: 3.3   Edit
Hardware: All All
: P3 normal with 1 vote (vote)
Target Milestone: 3.3 M7   Edit
Assignee: Thomas Watson CLA
QA Contact:
URL: http://thread.gmane.org/gmane.comp.id...
Whiteboard:
Keywords:
Depends on: 89768
Blocks:
  Show dependency tree
 
Reported: 2007-02-24 22:47 EST by Steven E. Harris CLA
Modified: 2007-04-05 12:16 EDT (History)
1 user (show)

See Also:


Attachments
patch (1.69 KB, patch)
2007-04-05 12:03 EDT, Thomas Watson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Steven E. Harris CLA 2007-02-24 22:47:33 EST
Build ID: 3.3M5

Steps To Reproduce:
1. Before calling EclipseLauncher.run(), create a set of Properties and try setting the property org.eclipse.core.runtime.adaptor.LocationManager.PROP_CONFIG_AREA to something like "@user.home/.myapp".
2. Supply this Property set to EclipseStarter.setInitialProperties().
3. Call EclipseStarter.run( new String[0], null ).
4. Observe the call to mungeConfigurationLocation() from initializeLocations() in org.eclipse.core.runtime.adaptor.
5. Observe that the property specified as "@user.home/.myapp" has been prepended by "file://<current working directory>" by LocationHelper.buildURL() (on line 41 with the call to "new File(spec).toURL()").
6. Observe that by the time mungeConfigurationLocation() returns and buildLocation() gets called on line 123, the osgi.configuration.area property is now a file-scheme URL, starting with the current working directory, followed by our original osgi.configuration.area property value, followed by a trailing slash.
7. Observe that buildLocation() thus fails to substitute the @user.home symbolic location at line 149, as our property value no longer begins with the symbolic location string, having been unintentionally prepended with the current working directory.

More information:
I reported this bug to the equinox-dev mailing list on 21 February 2007 with subject "Problem specifying osgi.config.area using symbolic location (@user.home)" with message ID <q944ppff4n0.fsf@chlorine.gnostech.com>, with the thread available here:

  http://thread.gmane.org/gmane.comp.ide.eclipse.equinox.devel/1381

As a possible fix, perhaps mungeConfigurationLocation() could be called after buildLocation() so that the location string is not prematurely forced to be a valid URL, allowing the symbolic locations to be expanded first.
Comment 1 Steven E. Harris CLA 2007-02-25 13:51:50 EST
See some related discussion in the comments for 108689, starting around comment #14:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=108689#c14
Comment 2 Steven E. Harris CLA 2007-02-26 12:50:08 EST
In step 4, I meant to mention the method

  org.eclipse.core.runtime.adaptor.LocationManager

but neglected to include the class name.
Comment 3 Steven E. Harris CLA 2007-02-26 12:53:26 EST
That is,

  org.eclipse.core.runtime.adaptor.LocationManager.mungeConfigurationLocation()

Third time's a charm.
Comment 4 Thomas Watson CLA 2007-03-30 17:37:40 EDT
Investigate fix/risk for M7.
Comment 5 Thomas Watson CLA 2007-04-05 12:03:19 EDT
Created attachment 63057 [details]
patch

This patch avoids calling buildURL in mungeConfigurationLocation.  This is dead code I think.  I don't know anyone who has ever launched Eclipse 3.0 or greater with -configuration someconfiguration/eclipse.cfg but the mungeConfigurationLocation seems to strip off the *.cfg in this case.  There is no reason for calling buildURL here other than to convert '\' to '/' chars.  There is also no need to add '/' to the end because that will be done later if needed.
Comment 6 Thomas Watson CLA 2007-04-05 12:16:19 EDT
Fix released to head.

For completeness, the reason this is not failing when using the launcher (eclipse.exe and org.eclipse.equinox.launcher) is because the launcher processes the configuration option first and does the correct substitution before we enter the framework.