Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 158010 Details for
Bug 233939
Cannot find file using IWorkspaceRoot.findFilesForLocation()
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Complete patch including regression test
bug233939.diff.txt (text/plain), 6.24 KB, created by
Martin Oberhuber
on 2010-02-03 04:07:24 EST
(
hide
)
Description:
Complete patch including regression test
Filename:
MIME Type:
Creator:
Martin Oberhuber
Created:
2010-02-03 04:07:24 EST
Size:
6.24 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.core.resources >Index: src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java,v >retrieving revision 1.122 >diff -u -r1.122 FileSystemResourceManager.java >--- src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java 25 Jan 2010 14:08:43 -0000 1.122 >+++ src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java 3 Feb 2010 08:51:07 -0000 >@@ -8,6 +8,7 @@ > * Contributors: > * IBM Corporation - initial API and implementation > * Martin Oberhuber (Wind River) - [210664] descriptionChanged(): ignore LF style >+ * Martin Oberhuber (Wind River) - [233939] findFilesForLocation() with symlinks > *******************************************************************************/ > package org.eclipse.core.internal.localstore; > >@@ -50,7 +51,18 @@ > * </p> > */ > protected ArrayList allPathsForLocation(URI inputLocation) { >- URI location = FileUtil.canonicalURI(inputLocation); >+ URI canonicalLocation = FileUtil.canonicalURI(inputLocation); >+ // First, try the canonical version of the inputLocation. >+ // If the inputLocation is different from the canonical version, it will be tried second >+ ArrayList results = allPathsForLocationNonCanonical(canonicalLocation); >+ if(results.size()==0 && canonicalLocation!=inputLocation) { >+ results = allPathsForLocationNonCanonical(inputLocation); >+ } >+ return results; >+ } >+ >+ private ArrayList allPathsForLocationNonCanonical(URI inputLocation) { >+ URI location = inputLocation; > final boolean isFileLocation = EFS.SCHEME_FILE.equals(inputLocation.getScheme()); > final IWorkspaceRoot root = getWorkspace().getRoot(); > final ArrayList results = new ArrayList(); >#P org.eclipse.core.tests.resources >Index: src/org/eclipse/core/tests/resources/regression/AllTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/AllTests.java,v >retrieving revision 1.41 >diff -u -r1.41 AllTests.java >--- src/org/eclipse/core/tests/resources/regression/AllTests.java 5 Oct 2009 12:32:36 -0000 1.41 >+++ src/org/eclipse/core/tests/resources/regression/AllTests.java 3 Feb 2010 08:51:08 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -53,6 +53,7 @@ > suite.addTest(Bug_165892.suite()); > suite.addTest(Bug_226264.suite()); > suite.addTest(Bug_231301.suite()); >+ suite.addTest(Bug_233939.suite()); > suite.addTest(Bug_265810.suite()); > suite.addTest(Bug_264182.suite()); > suite.addTest(Bug_288315.suite()); >Index: src/org/eclipse/core/tests/resources/regression/Bug_233939.java >=================================================================== >RCS file: src/org/eclipse/core/tests/resources/regression/Bug_233939.java >diff -N src/org/eclipse/core/tests/resources/regression/Bug_233939.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/tests/resources/regression/Bug_233939.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,89 @@ >+/******************************************************************************* >+ * Copyright (c) 2008, 2010 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.core.tests.resources.regression; >+ >+import java.io.IOException; >+import junit.framework.Test; >+import junit.framework.TestSuite; >+import org.eclipse.core.filesystem.EFS; >+import org.eclipse.core.resources.*; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.tests.resources.ResourceTest; >+ >+public class Bug_233939 extends ResourceTest { >+ /** >+ * Constructor for Bug_233939. >+ */ >+ public Bug_233939() { >+ super(); >+ } >+ >+ /** >+ * Constructor for Bug_233939. >+ * @param name >+ */ >+ public Bug_233939(String name) { >+ super(name); >+ } >+ >+ public static Test suite() { >+ return new TestSuite(Bug_233939.class); >+ } >+ >+ public void testBug() { >+ // only activate this test on platforms that support it >+ if (!isAttributeSupported(EFS.ATTRIBUTE_SYMLINK)) >+ return; >+ String fileName = "file.txt"; >+ >+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); >+ IProject project = root.getProject(getUniqueString()); >+ IFile file = project.getFile(fileName); >+ >+ IPath fileInTempDirPath = getTempDir().addTrailingSeparator().append(fileName); >+ >+ // create a project >+ try { >+ project.create(getMonitor()); >+ project.open(getMonitor()); >+ } catch (CoreException e) { >+ fail("1.0", e); >+ } >+ >+ // create a file in the temp dir >+ try { >+ fileInTempDirPath.toFile().createNewFile(); >+ } catch (IOException e) { >+ fail("2.0", e); >+ } >+ >+ // create a link to the file in the temp dir and refresh, >+ // the resource in the workspace should have symbolic link attribute set >+ createSymLink(project.getLocation().toFile(), fileName, fileInTempDirPath.toString(), false); >+ try { >+ project.refreshLocal(IResource.DEPTH_INFINITE, getMonitor()); >+ } catch (CoreException e) { >+ fail("3.0", e); >+ } >+ assertExistsInWorkspace("4.0", file); >+ assertTrue("5.0", file.getResourceAttributes().isSymbolicLink()); >+ >+ IFile[] files = root.findFilesForLocation(file.getLocation()); >+ assertEquals("7.0", 1, files.length); >+ assertEquals("7.1", file, files[0]); >+ >+ // IFile[] files = root.findFilesForLocation(fileInTempDirPath); >+ // assertEquals("6.0", 1, files.length); >+ // assertEquals("6.1", file, files[0]); >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 233939
:
102141
|
106447
|
106449
| 158010