Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 321713

Summary: An exception has been caught while processing the refactoring 'Delete'
Product: [WebTools] WTP Source Editing Reporter: Gerry Kaplan <gkaplan>
Component: wst.sseAssignee: wst.sse <wst.sse-inbox>
Status: CLOSED INVALID QA Contact: Nitin Dahyabhai <thatnitind>
Severity: major    
Priority: P3 CC: daniel_megert, nsand.dev
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Gerry Kaplan CLA 2010-08-04 09:08:09 EDT
Build Identifier: 20100617-1415

This problem has occurred with both XML and HTML files. It hasn't happened with java files.


On step 4, here is the error details:

An exception has been caught while processing the refactoring 'Delete'.

Reason: Problems encountered while deleting resources.

From Error Log:

Thu Jul 29 14:48:14 EDT 2010
Could not delete 'C:\Users\gkaplan\Documents\Workspace\TestProject\WebContent \WEB-INF\NewFile.xml'.

org.eclipse.core.runtime.CoreException: Problems encountered while deleting files.
at org.eclipse.core.internal.filesystem.local.LocalFile.delete( LocalFile.java:125)
at org.eclipse.core.internal.resources.ResourceTree.internalDel eteFile(ResourceTree.java:304)
at org.eclipse.core.internal.resources.ResourceTree.standardDel eteFile(ResourceTree.java:785)
at org.eclipse.core.internal.resources.Resource.unprotectedDele te(Resource.java:1934)
at org.eclipse.core.internal.resources.Resource.delete(Resource .java:786)
at org.eclipse.ltk.core.refactoring.resource.DeleteResourceChan ge.perform(DeleteResourceChange.java:138)
at org.eclipse.ltk.core.refactoring.CompositeChange.perform(Com positeChange.java:278)
at org.eclipse.jdt.internal.corext.refactoring.changes.DynamicV alidationStateChange.access$0(DynamicValidationStateChange.j ava:1)
at org.eclipse.jdt.internal.corext.refactoring.changes.DynamicV alidationStateChange$1.run(DynamicValidationStateChange.java :98)
at org.eclipse.jdt.internal.core.BatchOperation.executeOperatio n(BatchOperation.java:39)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaMod elOperation.java:728)
at org.eclipse.core.internal.resources.Workspace.run(Workspace. java:1975)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4777)
at org.eclipse.jdt.internal.corext.refactoring.changes.DynamicV alidationStateChange.perform(DynamicValidationStateChange.ja va:101)
at org.eclipse.ltk.core.refactoring.CompositeChange.perform(Com positeChange.java:278)
at org.eclipse.jdt.internal.corext.refactoring.changes.DynamicV alidationStateChange.access$0(DynamicValidationStateChange.j ava:1)
at org.eclipse.jdt.internal.corext.refactoring.changes.DynamicV alidationStateChange$1.run(DynamicValidationStateChange.java :98)
at org.eclipse.jdt.internal.core.BatchOperation.executeOperatio n(BatchOperation.java:39)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaMod elOperation.java:728)
at org.eclipse.core.internal.resources.Workspace.run(Workspace. java:1975)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4777)
at org.eclipse.jdt.internal.corext.refactoring.changes.DynamicV alidationStateChange.perform(DynamicValidationStateChange.ja va:101)
at org.eclipse.ltk.core.refactoring.CompositeChange.perform(Com positeChange.java:278)
at org.eclipse.ltk.core.refactoring.PerformChangeOperation$1.ru n(PerformChangeOperation.java:258)
at org.eclipse.core.internal.resources.Workspace.run(Workspace. java:1975)
at org.eclipse.ltk.core.refactoring.PerformChangeOperation.exec uteChange(PerformChangeOperation.java:306)
at org.eclipse.ltk.internal.ui.refactoring.UIPerformChangeOpera tion.executeChange(UIPerformChangeOperation.java:92)
at org.eclipse.ltk.core.refactoring.PerformChangeOperation.run( PerformChangeOperation.java:218)
at org.eclipse.core.internal.resources.Workspace.run(Workspace. java:1975)
at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAda pter.run(WorkbenchRunnableAdapter.java:87)
at org.eclipse.jface.operation.ModalContext$ModalContextThread. run(ModalContext.java:121)
Contains: Could not delete: C:\Users\gkaplan\Documents\Workspace\TestProject\WebContent\ WEB-INF\NewFile.xml.


Reproducible: Always

Steps to Reproduce:
1. Under WEB-INF, I will right click, create a new XML file.
2. In the XML editor, I just add a root element <hello/>
3. Save the file and then close it.
4. Try and delete it. FAIL.
5. Close the project, and re-open; try to delete. FAIL.
6. Close the project and delete from Windows: FAIL.
7. Open the project and delete from Windows: SUCCEED
Comment 1 Gerry Kaplan CLA 2010-08-04 09:10:23 EDT
I forgot to mention, I did this with an HTML file and the following was observed:

1. Right click, create new HTML file under WEB-INF. New file tab opens with HTML in it.
2. Right click on the file name and try to delete. FAIL.
3. Close the tab and try to delete. FAIL.
4. Close the project, re-open and try to delete. SUCCEED.
Comment 2 Dani Megert CLA 2010-08-05 02:01:45 EDT
Looks like the editor is not closing all the files it accesses.
Comment 3 Gerry Kaplan CLA 2010-08-05 09:45:00 EDT
(In reply to comment #2)
> Looks like the editor is not closing all the files it accesses.

I did another test yesterday (as this problem is REALLY annoying). I checked all of my project files in to CVS, created a brand new Workspace, imported the project into the new workspace. Then, in the new project, I just right clicked, created a new test.html file, then I closed the editor to make sure the file wasn't being locked, then I tried to delete it. It failed with the same error, so I know it isn't something in a corrupted workspace.
Comment 4 Nick Sandonato CLA 2010-08-05 10:42:36 EDT
Unfortunately, I have not been able to reproduce this with a clean install of  Eclipse for Java EE Developers. Are you seeing this problem with any type of file that you put under the WEB-INF directory (e.g., will foo.txt or foo.js also cause this problem)? Is it only when files are put in the WEB-INF directory?

Also, I noticed you said that you had checked in the project to CVS and then checked it out into a clean workspace. Does this happen on a brand new empty project if you were to add a file to it and try and delete that file?

Thanks.
Comment 5 Gerry Kaplan CLA 2010-08-05 11:20:34 EDT
I created a new project, not connected to CVS, created a file and tried to delete it, with failure. Then I created a java file, successfully deleted it. Then tried to delete the original html - failed again.

http://ibmcomposer.org/deleteproblem/deleteproblem.html

You are welcome to connect to my machine if you like. This is a reasonably fresh install of Helios in its own new directory.
Comment 6 Gerry Kaplan CLA 2010-08-05 12:01:51 EDT
I tried a few more experiments.

1. I closed the project, then re-opened.
2. Using Windows Process Explorer, I looked to see if there was any lock on the file testHtml1.html. There was NO lock on it.
3. In Eclipse, I attempted to delete the file. FAIL.
4. Searched in Process Explorer again, and now the file has a lock on it.

So, apparently the delete process is causing the lock. Also, this happens with a rename or move. The file is actually copied to a new location (or to a new name), but the deletion of the original file fails.

I also tried the following test:

1. In the project's root (not WEB-INF), I created a text file, "Foobar.txt"
2. Put some text in it, and saved.
3. Attempted to delete, failed with the same problem.
Comment 7 Gerry Kaplan CLA 2010-08-05 14:51:15 EDT
Some more interesting observations.

1. Right click on WebContent, create a file abc.html.
2. Click on "WebContent" and make it the active selection in the tree.
3. USE THE KEYBOARD to move the cursor down to the newly created abc.html.
4. Press the DELETE key. SUCCESS.
5. Repeat various combinations creating multiple files, but selecting with mouse, but deleting with KEYBOARD. SUCCESS.
6. Create a new HTML file. 
7. Select with either mouse or keyboard, but delete with RIGHT CLICK/Delete. FAIL.

Seems like there is something going wrong with the delete context menu item. Files can be deleted with the Delete KEY on the KEYBOARD, but NEVER with the right click.

I'll post another video.
Comment 8 Gerry Kaplan CLA 2010-08-05 15:00:32 EDT
Here is a video showing how the keyboard works, but the context menu doesn't. Somehow the context menu is causing a file lock to occur.

http://flygerry.com/DeleteByKbd/DeleteByKbd.html
Comment 9 Gerry Kaplan CLA 2010-08-05 17:22:27 EDT
I installed a new Helios and tested, and the right-click+delete worked.
I added "OxygenXML" and tested, and it still seems to work.

The only other plug-in I added (which I haven't tested yet but don't have time) is the Spring STS. I will try that tomorrow.

Is there a way to see if a specific plugin has taken ownership of the right-click+delete action?
Comment 10 Gerry Kaplan CLA 2010-08-06 08:03:45 EDT
OK, I uninstalled SpringSource Tool Suite (STS) and the problem seems to have gone away. I will alert SpringSource as to this problem. If it turns out to be confirmed with them, how can I close this bug?
Comment 11 Nick Sandonato CLA 2010-08-06 10:19:45 EDT
Thanks a lot for your persistence in your investigation, Gerry! If it turns out to be their bug, just post that back here and I can close it out for you.
Comment 12 Gerry Kaplan CLA 2010-08-10 09:02:17 EDT
Spring (VMWare) has verified this behavior with their Spring Tool Suite. Please close this bug.
Comment 13 Nick Sandonato CLA 2010-08-10 09:40:15 EDT
Thanks again, Gerry! Closing based on Gerry's findings.
Comment 14 Terry Denney CLA 2010-08-19 16:33:35 EDT
Thanks for reporting this Gerry. This bug has been filed and resolved in STS.

STS-1157: Deleting a file located under WebContent is not always possible
https://issuetracker.springsource.com/browse/STS-1157