Bug 189441 - [efs] New Project using RSE can't be done with Local Connection
Summary: [efs] New Project using RSE can't be done with Local Connection
Status: CLOSED FIXED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 2.0.1   Edit
Assignee: Martin Oberhuber CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-28 10:08 EDT by Kevin Doyle CLA
Modified: 2012-05-23 17:38 EDT (History)
2 users (show)

See Also:


Attachments
Path must start with "/" and URI's can't contain "\" (1.50 KB, patch)
2007-07-12 09:59 EDT, Kevin Doyle CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Doyle CLA 2007-05-28 10:08:53 EDT
After selecting the location of the project using the Select Folder 
dialog the location field is not filled in, if you select a folder from 
the Local connection.

Steps to Reproduce:
Go to New -> Project. 
Expand General and select Project. 
Uncheck "Use default location". 
Change file system from default to RSE. 
Click Browse.  Select any folder and click okay. 
Location field is not filled in.

-----------Enter bugs above this line-----------
TM 2.0RC1 Testing
installation : eclipse-SDK-3.3M7
RSE install  : RSE 2.0 RC1
java.runtime : Sun 1.5.0_11-b03
os.name:     : Windows XP, Service Pack 2
------------------------------------------------
Comment 1 Martin Oberhuber CLA 2007-05-29 14:45:22 EDT
Hm, I've been doing this before and it always worked for me.
Need to investigate.
Comment 2 Kevin Doyle CLA 2007-07-12 09:59:43 EDT
Created attachment 73658 [details]
Path must start with "/" and URI's can't contain "\"

The issue is that URI's can't contain "\", but getting the absolutepath of a file on windows will contain "\".  Also if you specify a hostname when creating a URI the path must start with "/", but on Windows this wasn't the case.

Legal Message: I, Kevin Doyle, declare that I developed attached code from
scratch, without referencing any 3rd party materials except material licensed
under the EPL. I am authorized by my employer, IBM Canada Ltd. to make this
contribution under the EPL.
Comment 3 Martin Oberhuber CLA 2007-07-12 11:42:40 EDT
Thanks for the patch, but I think it is a little too simple because on UNIX, it is valid that file names contain the \ character -- these would be lost by your patch.

One safe option is to try IRemoteFileSubSystem.isUnixStyle() to check whether the path should be translated. The other option, which I'd personally prefer (since isUnixStyle() is not 100% reliable because it is computed statically) is this:

String sep = PathUtility.getSeparator(path);
if (!sep.equals("/")) {
    path = path.replace(sep.charAt(0),'/'));
}

for prepending the /, I think you should use the code from URIUtil.toURI() in order to also handle UNC. This one is also used in the base implementation of FileSystemContributor.getURI() (so we should also use it in our getURI(), I think).
Comment 4 Kevin Doyle CLA 2007-07-12 14:25:52 EDT
Martin, have you tried to do a project with a folder that has a "\" on unix?  When I was creating the patch I only added the "/" to the front of the path at first and then it would display the URI in the dialog, but you couldn't continue as it was an invalid URI b/c of the "\", which became %5.  Also I can't rename a file/folder on a dstore linux machine to contain a "\" or I would try this myself.

The URI looked like this:  rse://LOCALHOST/D:%5Ckevin%5Callfiles

Thanks for the points on URI's.
Comment 5 Martin Oberhuber CLA 2007-08-09 06:30:52 EDT
Fixed the issue properly:

[189441] fix EFS operations on Windows (Local) systems
   RSEFileSystemContributor  1.2
   RSEFileStore.java  1.2
Comment 6 Martin Oberhuber CLA 2007-08-09 11:29:33 EDT
Verified on Linux that from the URI point of view, \ characters are escaped properly as %5C. But there are other issues with \ characters, being tracked as bug #199448. Not following this for now.
Comment 7 Kevin Doyle CLA 2007-08-24 16:21:05 EDT
Verified with I20070823-0800.
Comment 8 Martin Oberhuber CLA 2012-05-23 17:38:38 EDT
Comment on attachment 73658 [details]
Path must start with "/" and URI's can't contain "\"

This patch was not adopted.