Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 218491

Summary: ArchiveHandlerManager#cleanUpVirtualPath is messing up the file separators
Product: [Tools] Target Management Reporter: Radoslav Gerganov <rgerganov>
Component: RSEAssignee: Xuan Chen <xuanchen>
Status: CLOSED FIXED QA Contact: Martin Oberhuber <mober.at+eclipse>
Severity: major    
Priority: P1    
Version: 2.0   
Target Milestone: 3.0 M5   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Bug Depends on:    
Bug Blocks: 220256    

Description Radoslav Gerganov CLA 2008-02-11 07:48:51 EST
I am implementing a file subsystem for WinCE and I am having problems with creating file filters other than "/" (which lists roots). 
On WinCE the root directory is "\" and there are no volumes. The path separator is \, so we have the following directory structure:

\
\Temp
\My Documents
\Windows
\Windows\System
...

When I try to resolve some file filter, e.g. "\My Documents\*", FileServiceSubSystem#getRemoteFileObject returns null and the filter cannot be resolved. Consider the following code:

public IRemoteFile getRemoteFileObject(...) {
  String fofName = folderOrFileName;
  if (folderOrFileName.length() > 1) {
    fofName = ArchiveHandlerManager.cleanUpVirtualPath(folderOrFileName);
  }
  ...
}

public static String cleanUpVirtualPath(String fullVirtualName)	{
  int j = fullVirtualName.indexOf(VIRTUAL_CANONICAL_SEPARATOR);
  if (j == -1 && fullVirtualName.indexOf(":") != -1) return fullVirtualName;
  ...
}

cleanUpVirtualPath is supposed to return the same string if the specified path is not virtual. The test for not being virtual is to contain both VIRTUAL_CANONICAL_SEPARATOR and ":". This test is satisfied for "C:\My Documents\" but fails for "\My Documents\". So the latter is considered virtual path and all separators are changed to / which is not correct.

Looking only for VIRTUAL_CANONICAL_SEPARATOR seems to fix the problem but I don't know what are the other implications of this change because I am not very familiar with virtual paths.
Comment 1 Radoslav Gerganov CLA 2008-02-11 07:53:52 EST
Sorry, I meant that the method returns the original path if it doesn't contain VIRTUAL_CANONICAL_SEPARATOR and it contains ":".
Comment 2 Martin Oberhuber CLA 2008-02-11 08:03:39 EST
Xuan can you look at this ASAP or reassign if you can't.
Comment 3 Xuan Chen CLA 2008-02-11 10:28:46 EST
We don't need to check ":" in this case.  I will make the fix.
Comment 4 Xuan Chen CLA 2008-02-11 10:49:00 EST
I've checked in the fix to cvs.
Comment 5 Radoslav Gerganov CLA 2008-02-11 10:51:54 EST
Thanks Xuan.
Comment 6 Xuan Chen CLA 2008-02-15 00:41:03 EST
reopen it to check in fix.
Comment 7 Xuan Chen CLA 2008-02-15 00:42:26 EST
Committed the fix into cvs.

Radoslav,
Could you please verify if the fix is good for your scenario?  Thanks.
Comment 8 Radoslav Gerganov CLA 2008-02-15 02:52:13 EST
The fix is working however I've found another problems (bug #218947) with getRemoteFileObject, so I'm going to override it with my own implementation as Martin suggested.
Comment 9 Xuan Chen CLA 2010-11-26 10:59:11 EST
Close it.