Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 361160 - Misbehavior of isValidPath in Path class
Summary: Misbehavior of isValidPath in Path class
Status: RESOLVED INVALID
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Runtime (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: platform-runtime-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-17 11:37 EDT by pdu CLA
Modified: 2011-10-28 03:25 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 pdu CLA 2011-10-17 11:37:23 EDT
Build Identifier: Version: 3.7.0 Build id: I20110613-1736

I planned to use isValidPath from org.eclipse.core.runtime.Path
Unfortunatly it seems that this function is far from working. it only checks that path segments doesn't contain ':' 
Under windows, forbidden characters are :
    < (less than)
    > (greater than)
    : (colon)
    " (double quote)
    / (forward slash)
    \ (backslash)
    | (vertical bar or pipe)
    ? (question mark)
    * (asterisk)

Plus characters 1 to 31

I thing Linux is less restrictive.



Reproducible: Always

Steps to Reproduce:
1. try c:\sdsd/ <>/   ///    /  \\
isValidPath returns true
2. try c:\sdsd/ <>/   //:/    /  \\
isValidPath returns false
Comment 1 DJ Houghton CLA 2011-10-27 09:44:57 EDT
Adding John to CC as he is the API guy but I believe this is the expected behaviour. An IPath represents a path object in the workspace and is not meant to be tied directly to the file-system.
Comment 2 John Arthorne CLA 2011-10-27 10:15:31 EDT
Yes this is behaving as specified. IPath#isValidPath just checks that the segments are valid. isValidSegment just specifies that they cannot contain device or path separators. An IPath does not necessarily represent a local file system path on your local machine. It could be used to represent a file system path on another machine, or simply a hierarchical series of segments.

There is a method IWorkspace#validateName that will do operating system specified checks.
Comment 3 pdu CLA 2011-10-28 03:25:22 EDT
Thanks a lot guys for clarification ! I appreciated it