Bug 563749

Summary: [inline renaming] Renaming a resource to an already existing name logs an internal error
Product: [Eclipse Project] Platform Reporter: Thomas Wolf <twolf>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: aobuchow
Version: 4.16   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X   
Whiteboard:

Description Thomas Wolf CLA 2020-05-30 08:04:50 EDT
Error logged after trying inline rename in the project explorer on org.eclipse.jdt/notice.html trying to rename it to about.html:

org.eclipse.core.internal.resources.ResourceException(/org.eclipse.jdt/about.html)[374]: java.lang.Exception: Resource '/org.eclipse.jdt/about.html' already exists.
	at org.eclipse.core.internal.resources.ResourceException.provideStackTrace(ResourceException.java:42)
	at org.eclipse.core.internal.resources.ResourceException.<init>(ResourceException.java:38)
	at org.eclipse.core.internal.resources.Resource.checkDoesNotExist(Resource.java:309)
	at org.eclipse.core.internal.resources.Resource.checkDoesNotExist(Resource.java:296)
	at org.eclipse.core.internal.resources.Resource.checkMoveRequirements(Resource.java:385)
	at org.eclipse.core.internal.resources.Resource.assertMoveRequirements(Resource.java:195)
	at org.eclipse.core.internal.resources.Resource.move(Resource.java:1486)
	at org.eclipse.ltk.core.refactoring.resource.RenameResourceChange.perform(RenameResourceChange.java:118)
	at org.eclipse.ltk.core.refactoring.CompositeChange.perform(CompositeChange.java:281)
	at org.eclipse.ltk.internal.ui.refactoring.actions.RenameResourceHandler.performRename(RenameResourceHandler.java:108)
	at org.eclipse.ltk.internal.ui.refactoring.actions.RenameResourceHandler.execute(RenameResourceHandler.java:57)

Eclipse IDE for Eclipse Committers

Version: 2020-06 (4.16.0)
Build id: 20200507-0346
Comment 1 Thomas Wolf CLA 2020-05-30 08:09:31 EDT
RenameResourceAction only checks whether the new file name per se is valid and shows a dialog if not, but it doesn't check whether a resource with the new name already exists.

In the project explorer, the error is only logged; the rename fails (the resource is not renamed), but there's no other user feedback.

Just as a hint: the inline rename in the git repositories view for repository groups validates the user input on the fly, shows errors in a popup, and refuses to even try to execute the renaming if the input isn't valid.