| Summary: | validateLinkLocationURI check for "path overlaps the location of the given project" is incorrect | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Farokh Morshed <fmorshed> |
| Component: | Resources | Assignee: | Platform-Resources-Inbox <platform-resources-inbox> |
| Status: | RESOLVED INVALID | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | serge |
| Version: | 3.5 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
That condition looks fine to me, since if the location (for example "C:\foo\bar") is a prefix of the project location (say, "C:\foo\bar\project"), then that's an invalid location. I'm not able to reproduce the issue with the steps you gave either. I created a project in /workspace/sample_p I created a file in that project: /workspace/sample_p/file.txt Then I try to create a link resource file pointing to that location in project "sample_p". It works fine (using 3.6 RC2). Sorry, I read the rules incorrectly. I suppose you can have two workspace handles pointing to the same file on disk. Why not. It can happen in nested projects too. Looks like the intent of the code I cited is to not let you create a directory link whose target is the project in which you are creating the handle in, or a directory above it. That's a little weird, but so be it. Thank you. |
Build Identifier: M20090917-0800 method org.eclipse.core.internal.resources.LocationValidator.validateLinkLocationURI Has this code: //test if the given path overlaps the location of the given project testLocation = resource.getProject().getLocationURI(); if (testLocation != null && FileUtil.isPrefixOf(location, testLocation)) { message = NLS.bind(Messages.links_locationOverlapsProject, toString(location)); return new ResourceStatus(IResourceStatus.INVALID_VALUE, resource.getFullPath(), message); } Looks to me that the location and testLocation parameters in the call to FileUtil.isPrefixOf should be reversed!! Reproducible: Always Steps to Reproduce: 1. You can use the File | New | File dialog to create a link, and as target give a file in the open project itself. The rules seem to not allow this, but the code allows it ! 2. 3.