Community
Participate
Working Groups
Build ID: 3.4M6 (I20080330-1350) Steps To Reproduce: 1.create a project 2.create a folder linked to some folder outside the workspace 3.create a folder 4. delete folder created on step 3 - delta is fired, project delta node has DESCRIPTION flag set though no changes to description has been made. More information: The bug is introduced in org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Resource.java in revision 1.156. Below are fragments from method deleteResource(): <<CITE START // if this is a linked resource or contains linked resources , remove their entries from the project description List links = findLinks(); ..... //remove all deleted linked resources from the project description if (getType() != IResource.PROJECT && links != null) { Project project = (Project) getProject(); ProjectDescription description = project.internalGetDescription(); for (Iterator it = links.iterator(); it.hasNext();) description.setLinkLocation(((IResource) it.next()).getProjectRelativePath(), null); project.internalSetDescription(description, true); project.writeDescription(IResource.FORCE); } <<CITE END So if findLinks returns an emply list (not null) thi method will force setting description without actual changes to it. And here's the findLinks: <<CITE START /* * Returns a list of all linked resources at or below this resource, or null if there * are no links. */ private List findLinks() { Project project = (Project) getProject(); ProjectDescription description = project.internalGetDescription(); HashMap linkMap = description.getLinks(); if (linkMap == null) return null; List links = new ArrayList(); IPath myPath = getProjectRelativePath(); for (Iterator it = linkMap.values().iterator(); it.hasNext();) { LinkDescription link = (LinkDescription) it.next(); IPath linkPath = link.getProjectRelativePath(); if (myPath.isPrefixOf(linkPath)) links.add(workspace.newResource(project.getFullPath().append(linkPath), link.getType())); } return links; } <<CITE END It obviously can return an empty list despite it's description says that it should return nulls if no related links found. The code which uses this method relies on the behaviour compliant to the description and there's only one place which calls this method so it can be changed in following way: /* * Returns a list of all linked resources at or below this resource, or null if there * are no links. */ private List findLinks() { Project project = (Project) getProject(); ProjectDescription description = project.internalGetDescription(); HashMap linkMap = description.getLinks(); if (linkMap == null) return null; List links = null; IPath myPath = getProjectRelativePath(); for (Iterator it = linkMap.values().iterator(); it.hasNext();) { LinkDescription link = (LinkDescription) it.next(); IPath linkPath = link.getProjectRelativePath(); if (myPath.isPrefixOf(linkPath)){ if (links == null){ links = new ArrayList(); } links.add(workspace.newResource(project.getFullPath().append(linkPath), link.getType())); } } return links; }
It is a general issue, not only MacOs one.
Created attachment 110549 [details] Test v01
Created attachment 110552 [details] Test v01 &Fix
Released to R3_4_maintenance and HEAD.