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 197587 Details for
Bug 343584
[ltk][reorg] Deleting physically nested projects can cause exceptions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch v3 with tests
bug343584.txt (text/plain), 9.67 KB, created by
Markus Keller
on 2011-06-08 08:04:54 EDT
(
hide
)
Description:
Patch v3 with tests
Filename:
MIME Type:
Creator:
Markus Keller
Created:
2011-06-08 08:04:54 EDT
Size:
9.67 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P JDT-UI Team Documents >Index: 3.8/external_contributors.txt >=================================================================== >RCS file: 3.8/external_contributors.txt >diff -N 3.8/external_contributors.txt >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ 3.8/external_contributors.txt 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,40 @@ >+Instructions: >+------------- >+ >+The 'iplog' flag has to be set on the *attachment* (normally patch) that contains the contribution. If there are >+multiple attachments being contributed, add the flag for each applicable attachment. This allows the system to >+automatically harvest data about the size of the contribution, who contributed it (the person who added the attachment), >+and the committer who processed the contribution (the person who set the 'iplog+' flag). >+ >+There is also an 'iplog' flag for the entire bug report next to the 'review' and 'pmc_approved' flags. This flag should >+only be used if the contribution is not in the form of an attachment. For example, you can use this if the contributor >+added code or pseudo-code directly in the comment field. The correct solution in this case is to ask the contributor to >+attach a proper patch so it can be flagged. If this is not possible or the contributor doesn't respond, you can resort >+to setting the global 'iplog' flag on the bug itself. What this flag does is flag every non-committer who added a >+comment to the bug as contributors. If there are comments in the same bug that are not part of the contribution, they >+then need to be excluded manually by editing the project IP log. >+ >+See http://wiki.eclipse.org/Development_Resources/Automatic_IP_Log#Contributors for more details. >+ >+ >+Management summary: iplog+ copyright notice >+------------------- ------ ---------------- >+- IBMer which is not a committer on the Eclipse project: + no >+- IBMer which is a committer on the Eclipse project: no no >+- External committer (e.g. Tom): no + >+- External contributor: + + >+- Explicitly rejected from the lawyers: - N/A >+- Patches > 250 lines, crypto, etc. => see http://www.eclipse.org/legal/EclipseLegalProcessPoster.pdf >+ >+To count code lines in the "Apply Patch" wizard, set the following regexes in Preferences > General > Compare/Patch: >+Added lines: ^\+(?![\s/*#{}]*$).*$ >+Removed lines: ^-(?![\s/*#{}]*$).*$ >+ >+Fill out this template and add it to the header comment of each changed file: >+Your Name <email@example.com> - Bug Title - https://bugs.eclipse.org/BUG_NUMBER >+ >+ >+3.8 !!! NOTE: Set the 'iplog' flag on each attachment/patch (see above) !!! >+=== >+M1 >+- Szymon Ptaszkiewicz <szymon.ptaszkiewicz@pl.ibm.com> - [ltk][reorg] Deleting physically nested projects can cause exceptions - https://bugs.eclipse.org/343584 >#P org.eclipse.ltk.core.refactoring >Index: src/org/eclipse/ltk/internal/core/refactoring/resource/DeleteResourcesProcessor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ltk.core.refactoring/src/org/eclipse/ltk/internal/core/refactoring/resource/DeleteResourcesProcessor.java,v >retrieving revision 1.10 >diff -u -r1.10 DeleteResourcesProcessor.java >--- src/org/eclipse/ltk/internal/core/refactoring/resource/DeleteResourcesProcessor.java 13 Dec 2008 17:21:39 -0000 1.10 >+++ src/org/eclipse/ltk/internal/core/refactoring/resource/DeleteResourcesProcessor.java 8 Jun 2011 12:02:17 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007, 2008 IBM Corporation and others. >+ * Copyright (c) 2007, 2011 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 >@@ -10,6 +10,7 @@ > *******************************************************************************/ > package org.eclipse.ltk.internal.core.refactoring.resource; > >+import java.net.URI; > import java.util.ArrayList; > import java.util.Arrays; > >@@ -287,14 +288,26 @@ > > private static void addToList(ArrayList result, IResource curr) { > IPath currPath= curr.getFullPath(); >- for (int k= result.size() - 1; k >= 0 ; k--) { >- IResource other= (IResource) result.get(k); >+ URI currURI= curr.getLocationURI(); >+ for (int k= result.size() - 1; k >= 0; k--) { >+ IResource other= (IResource)result.get(k); > IPath otherPath= other.getFullPath(); > if (otherPath.isPrefixOf(currPath)) { > return; // current entry is a descendant of an entry in the list > } > if (currPath.isPrefixOf(otherPath)) { > result.remove(k); // entry in the list is a descendant of the current entry >+ } else if (curr.getType() == IResource.PROJECT && other.getType() == IResource.PROJECT) { >+ // handle nested projects (bug 343584) >+ URI otherURI= other.getLocationURI(); >+ if (currURI != null && otherURI != null) { >+ if (otherURI.relativize(currURI) != currURI) { >+ return; // current entry is a descendant of an entry in the list >+ } >+ if (currURI.relativize(otherURI) != otherURI) { >+ result.remove(k); // entry in the list is a descendant of the current entry >+ } >+ } > } > } > result.add(curr); >#P org.eclipse.ltk.core.refactoring.tests >Index: src/org/eclipse/ltk/core/refactoring/tests/resource/ResourceRefactoringTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/resource/ResourceRefactoringTests.java,v >retrieving revision 1.5 >diff -u -r1.5 ResourceRefactoringTests.java >--- src/org/eclipse/ltk/core/refactoring/tests/resource/ResourceRefactoringTests.java 31 Dec 2008 21:14:19 -0000 1.5 >+++ src/org/eclipse/ltk/core/refactoring/tests/resource/ResourceRefactoringTests.java 8 Jun 2011 12:02:18 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2008 IBM Corporation and others. >+ * Copyright (c) 2008, 2011 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 >@@ -21,7 +21,11 @@ > import org.eclipse.core.resources.IContainer; > import org.eclipse.core.resources.IFile; > import org.eclipse.core.resources.IFolder; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.IProjectDescription; > import org.eclipse.core.resources.IResource; >+import org.eclipse.core.resources.IWorkspace; >+import org.eclipse.core.resources.ResourcesPlugin; > > import org.eclipse.ltk.core.refactoring.Change; > import org.eclipse.ltk.core.refactoring.CheckConditionsOperation; >@@ -32,6 +36,7 @@ > import org.eclipse.ltk.core.refactoring.RefactoringCore; > import org.eclipse.ltk.core.refactoring.RefactoringDescriptor; > import org.eclipse.ltk.core.refactoring.RefactoringStatus; >+import org.eclipse.ltk.core.refactoring.resource.DeleteResourcesDescriptor; > import org.eclipse.ltk.core.refactoring.resource.MoveResourceChange; > import org.eclipse.ltk.core.refactoring.resource.MoveResourcesDescriptor; > import org.eclipse.ltk.core.refactoring.tests.util.SimpleTestProject; >@@ -195,7 +200,55 @@ > assertTrue(content2.equals(fProject.getContent(file2))); > } > >+ public void testDeleteRefactoring1_bug343584() throws Exception { >+ IFolder testFolder= fProject.createFolder("test"); >+ fProject.createFile(testFolder, "myFile.txt", "hello"); >+ >+ IProject testProject2= ResourcesPlugin.getWorkspace().getRoot().getProject(SimpleTestProject.TEST_PROJECT_NAME + "2"); >+ try { >+ testProject2.create(null); >+ testProject2.open(null); >+ >+ RefactoringContribution contribution= RefactoringCore.getRefactoringContribution(DeleteResourcesDescriptor.ID); >+ DeleteResourcesDescriptor descriptor= (DeleteResourcesDescriptor)contribution.createDescriptor(); >+ >+ descriptor.setDeleteContents(true); >+ descriptor.setResources(new IResource[] { fProject.getProject(), testProject2 }); >+ >+ perform(descriptor); >+ >+ assertFalse(fProject.getProject().exists()); >+ assertFalse(testProject2.exists()); >+ } finally { >+ testProject2.delete(true, true, null); >+ } >+ } > >+ public void testDeleteRefactoring2_bug343584() throws Exception { >+ >+ IFolder testFolder= fProject.createFolder("test"); >+ fProject.createFile(testFolder, "myFile.txt", "hello"); >+ >+ IWorkspace workspace= ResourcesPlugin.getWorkspace(); >+ String p2Name= "p2"; >+ IProjectDescription p2Description= workspace.newProjectDescription(p2Name); >+ p2Description.setLocation(fProject.getProject().getLocation().append(p2Name)); >+ IProject p2= workspace.getRoot().getProject(p2Name); >+ p2.create(p2Description, null); >+ p2.open(null); >+ >+ RefactoringContribution contribution= RefactoringCore.getRefactoringContribution(DeleteResourcesDescriptor.ID); >+ DeleteResourcesDescriptor descriptor= (DeleteResourcesDescriptor) contribution.createDescriptor(); >+ >+ descriptor.setDeleteContents(true); >+ descriptor.setResources(new IResource[] { fProject.getProject(), p2 }); >+ >+ perform(descriptor); >+ >+ assertFalse(fProject.getProject().exists()); >+ assertFalse(p2.exists()); >+ } >+ > private Change perform(Change change) throws CoreException { > PerformChangeOperation op= new PerformChangeOperation(change); > op.run(null);
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 343584
:
193866
|
194733
|
197318
|
197490
|
197587
|
197611
|
197698