Bug 295531 - Configuration properties not evaluated correctly if @user.home is used and the user id contains a "#".
Summary: Configuration properties not evaluated correctly if @user.home is used and th...
Status: CLOSED DUPLICATE of bug 3109
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Runtime (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: platform-runtime-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-18 18:58 EST by Nalini Ganapati CLA
Modified: 2011-08-22 08:47 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nalini Ganapati CLA 2009-11-18 18:58:43 EST
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)
Build Identifier: Eclipse 3.5.1 

If the user id contains a "#" on windows, the @user.home variable in config.ini do not evaluate correctly.

Reproducible: Always

Steps to Reproduce:
1. Add the following property osgi.instance.area=@user.home/workspace
2. Verify that the user id has a "#", e.g. IV#532
3. Bring up eclipse and see the workspace prompt evaluate to something like C:\Documents and Settings\IV instead of C:\Documents and Settings\IV#532\workspace.
Comment 1 Robin Tegg CLA 2010-04-30 05:03:01 EDT
Cause appears to be in the LocationManager.initialiseLocations() method

The issue is caused the way that Eclipse internally creates Location objects from URLs.

“# ? &“ are all special characters within URLs. Below is an example of constructing a URL with a user’s directory, whose name includes a “#” char

         URL url = new File( new File( "c:\\documents and settings" ), "#robin" ).toURL();
         // eclipse uses this method for storing the location
         System.out.println( "File:" + url.getFile() );
         // these are other parts so you can see where the #robin user name
         // goes. obviously this will affect any user name with a #?& and any
         // other non-escaped special URL character
         System.out.println( "Query:" + url.getQuery() );
         System.out.println( "Path:" + url.getPath() );
         System.out.println( "Ref:" + url.getRef() );

          Output:
              File:/c:/documents and settings/
              Query:null
              Path:/c:/documents and settings/
              Ref:robin

The user name gets stored as the “.ref” part of the URL.

Eclipse uses the url.getFile() method, which does not include the ref, when creating the User Location used in the tool.

The two classes causing the headaches are LocationManager.buildLocation() (line 155) and BasicLocation.setURL() (121).
Comment 2 Szymon Ptaszkiewicz CLA 2011-08-22 08:47:23 EDT
This is a known issue and documented in the README that is shipped with the SDK. See also bug 312772.

*** This bug has been marked as a duplicate of bug 3109 ***