Bug 7960 - Can't rename a package if you are just changing case
Summary: Can't rename a package if you are just changing case
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Erich Gamma CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-01-21 14:34 EST by Craig Doremus CLA
Modified: 2003-03-21 12:28 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Craig Doremus CLA 2002-01-21 14:34:15 EST
I'm using Eclipse ver 2 20011219 on Windows 2000. When trying to rename a 
package, changing only the case of one letter(e.g pageinfo to pageInfo) an 
error is thrown with only Undo or Abort options.

Error message:
CoreException: A resource exists with a different case:
<<the absolute path of the old file follows>>
Comment 1 Erich Gamma CLA 2002-01-21 18:03:42 EST
this is an instance of the file system case sensitivity issue.
Moving to platform core 
Comment 2 DJ Houghton CLA 2002-01-24 19:53:10 EST
Get the same message when trying to rename the following packages in the 
Packages view:
    com.foo.bar to com.foo.bAr

But no problems trying to rename in the Navigator view.

Moving to JDT/UI for comment.
Comment 3 Craig Doremus CLA 2002-01-24 21:36:41 EST
I also discovered that you can change the case of a package within the 
Navigator or Resource view, but references to the package within the class -- 
like the package statement at the top of the file -- or references to the 
package in other classes, are not changed.
Changing the case of a package in the Package or Java view results in the error 
I previously reported.
Comment 4 Erich Gamma CLA 2002-01-25 04:15:21 EST
Not updating the package statement when renaming in the Navigator is because 
the action in the navigator doesn't know about Java it is a resource only 
action.

Since the rename works in the Navigator then we need to investigate what how it 
solves the case sensitivity problem. 
Comment 5 Adam Kiezun CLA 2002-01-28 07:33:50 EST
there's not too much i can do now on the refactoring/refactoring ui side
the exception comes from the fact that Core does not provide any methods to
verify resource names (w.r.t. cases) 

see bug#6998

refactoring sits at the end of it all - i can do nothing here.
the navigator uses IResource::move to rename folders
jcore uses IFolder::create, which throws the exception

here's the stack trace for reference:

back to inbox for consideration on further action

org.eclipse.jdt.core.JavaModelException[966]: 
org.eclipse.core.internal.resources.ResourceException: A resource exists with a 
different case: /Test/Com.
	at org.eclipse.core.internal.resources.Folder.create(Folder.java:89)
	at org.eclipse.jdt.internal.core.JavaModelOperation.createFolder
(JavaModelOperation.java:193)
	at 
org.eclipse.jdt.internal.core.CopyResourceElementsOperation.createNeededPackageF
ragments(CopyResourceElementsOperation.java:133)
	at 
org.eclipse.jdt.internal.core.CopyResourceElementsOperation.processPackageFragme
ntResource(CopyResourceElementsOperation.java:302)
	at 
org.eclipse.jdt.internal.core.CopyResourceElementsOperation.processElement
(CopyResourceElementsOperation.java:269)
	at org.eclipse.jdt.internal.core.MultiOperation.processElements
(MultiOperation.java:181)
	at 
org.eclipse.jdt.internal.core.CopyResourceElementsOperation.processElements
(CopyResourceElementsOperation.java:283)
	at org.eclipse.jdt.internal.core.MultiOperation.executeOperation
(MultiOperation.java:85)
	at org.eclipse.jdt.internal.core.JavaModelOperation.execute
(JavaModelOperation.java:268)
	at org.eclipse.jdt.internal.core.JavaModelOperation.run
(JavaModelOperation.java:476)
	at org.eclipse.core.internal.resources.Workspace.run
(Workspace.java:1232)
	at org.eclipse.jdt.internal.core.JavaModelManager.runOperation
(JavaModelManager.java:1136)
	at org.eclipse.jdt.internal.core.JavaElement.runOperation
(JavaElement.java:526)
	at org.eclipse.jdt.internal.core.JavaModel.rename(JavaModel.java:467)
	at org.eclipse.jdt.internal.core.PackageFragment.rename
(PackageFragment.java:288)
	at 
org.eclipse.jdt.internal.corext.refactoring.changes.RenamePackageChange.doRename
(RenamePackageChange.java:60)
	at 
org.eclipse.jdt.internal.corext.refactoring.AbstractJavaElementRenameChange.perf
orm(AbstractJavaElementRenameChange.java:67)
	at 
org.eclipse.jdt.internal.corext.refactoring.CompositeChange.createUndoList
(CompositeChange.java:119)
	at org.eclipse.jdt.internal.corext.refactoring.CompositeChange.perform
(CompositeChange.java:144)
	at 
org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation$1.execute
(PerformChangeOperation.java:146)
	at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run
(WorkspaceModifyOperation.java:64)
	at org.eclipse.core.internal.resources.Workspace.run
(Workspace.java:1232)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.run
(WorkspaceModifyOperation.java:78)
	at 
org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.executeChange
(PerformChangeOperation.java:151)
	at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run
(PerformChangeOperation.java:132)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread
(ModalContext.java:296)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:249)
	at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:713)
	at 
org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish
(RefactoringWizard.java:307)
	at 
org.eclipse.jdt.internal.ui.refactoring.PreviewWizardPage.performFinish
(PreviewWizardPage.java:272)
	at 
org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish
(RefactoringWizard.java:438)
	at org.eclipse.jface.wizard.WizardDialog.finishPressed
(WizardDialog.java:570)
	at org.eclipse.jface.wizard.WizardDialog.buttonPressed
(WizardDialog.java:311)
	at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:344)
	at org.eclipse.swt.widgets.TypedListener.handleEvent
(TypedListener.java:85)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:74)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:637)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1413)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1205)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:536)
	at org.eclipse.jface.window.Window.open(Window.java:523)
	at 
org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate
(RefactoringStarter.java:83)
	at 
org.eclipse.jdt.internal.ui.reorg.RefactoringSupportFactory$RenameSupport.rename
(RefactoringSupportFactory.java:59)
	at org.eclipse.jdt.internal.ui.reorg.RenameAction.run
(RenameAction.java:36)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:452)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection
(ActionContributionItem.java:407)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent
(ActionContributionItem.java:361)
	at org.eclipse.jface.action.ActionContributionItem.access$0
(ActionContributionItem.java:352)
	at 
org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent
(ActionContributionItem.java:47)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:74)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:637)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1413)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1205)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:844)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:827)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:878)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:321)
	at SlimLauncher.main(SlimLauncher.java:14)

Comment 6 Erich Gamma CLA 2002-03-25 05:41:56 EST
in 2.0  your getting the error in the wizard
Comment 7 Boris Shingarov CLA 2003-03-21 12:28:26 EST
I was verifying another case sensitivity related bug (31820), and now I think 
I don't understand why the resolution to 7960 is to display an error in the 
rename wizard.  The core provides a mechanism for a folder rename; that's how 
one can change case of a folder in the Navigator.  I can not understand why 
package names should be different (unless it's simply an implementation 
limitation).