Bug 7255 - Rename of <Foo>Plugin.java crashes
Summary: Rename of <Foo>Plugin.java crashes
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 1.0   Edit
Hardware: PC Windows 2000
: P1 normal (vote)
Target Milestone: ---   Edit
Assignee: Adam Kiezun CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-01-04 09:38 EST by rolarenfan CLA
Modified: 2002-01-07 05:45 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rolarenfan CLA 2002-01-04 09:38:57 EST
build 137

Create a complete (but very simple) plugin, with Project name Foo, say; run it 
and observe that it works; decide to experiment with renaming items -- choose to 
rename the autogenerated class FooPlugin.java, hit Next, and get the stack trace 
below.  Repeatable, and does not depend on the exact new name entered (if you 
enter a name which causes a problem, e.g. by collision or violating a 
convention, you get the warning panel before the call stack).  The plugin is 
left in a working state (i.e., nothing seems to have actually changed). 

It may be that this class should never be renamed, but if so, this is an odd way 
to signal that!

(in case it might matter: the action has target id 
org.eclipse.jdt.ui.CompilationUnitEditor, the actions' class was auto-genned, 
and the run() method contains only one line, writing to System.out)

java.lang.StringIndexOutOfBoundsException: String index out of range: -11
	at java.lang.String.substring(String.java(Compiled Code))
	at 
org.eclipse.jdt.internal.core.refactoring.types.RenameTypeRefactoring$2.adjust(R
enameTypeRefactoring.java:418)
	at 
org.eclipse.jdt.internal.core.refactoring.text.AbstractTextBufferChange.internal
Perform(AbstractTextBufferChange.java:250)
	at 
org.eclipse.jdt.internal.core.refactoring.text.AbstractTextBufferChange.getPrevi
ew(AbstractTextBufferChange.java:222)
	at 
org.eclipse.jdt.internal.ui.refactoring.MergeTextViewerContentProvider.getRightC
ontent(MergeTextViewerContentProvider.java:108)
	at 
org.eclipse.compare.contentmergeviewer.ContentMergeViewer.inputChanged(ContentMe
rgeViewer.java:689)
	at 
org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:234)
	at 
org.eclipse.jdt.internal.ui.refactoring.PreviewWizardPage$2.selectionChanged(Pre
viewWizardPage.java:210)
	at 
org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:147)
	at 
org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java
:907)
	at 
org.eclipse.jface.viewers.StructuredViewer.setSelection(StructuredViewer.java:68
7)
	at org.eclipse.jface.viewers.Viewer.setSelection(Viewer.java:342)
	at 
org.eclipse.jdt.internal.ui.refactoring.PreviewWizardPage.setVisible(PreviewWiza
rdPage.java:340)
	at org.eclipse.jface.wizard.WizardDialog.showPage(WizardDialog.java:884)
	at 
org.eclipse.jface.wizard.WizardDialog.nextPressed(WizardDialog.java:648)
	at 
org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:309)
	at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:211)
	at 
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java(Compiled 
Code))
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java(Compiled 
Code))
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java(Compiled 
Code))
	at 
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java(Compiled Code))
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java(Compiled 
Code))
	at org.eclipse.jface.window.Window.runEventLoop(Window.java(Compiled 
Code))
	at org.eclipse.jface.window.Window.open(Window.java:523)
	at 
org.eclipse.jdt.internal.ui.reorg.RefactoringSupportFactory$RenameSupport.rename
(RefactoringSupportFactory.java:64)
	at 
org.eclipse.jdt.internal.ui.reorg.RenameAction.doActionPerformed(RenameAction.ja
va:79)
	at 
org.eclipse.jdt.internal.ui.reorg.ReorgAction.run(ReorgAction.java:131)
	at 
org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionCont
ributionItem.java:407)
	at 
org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent(ActionContribu
tionItem.java:361)
	at 
org.eclipse.jface.action.ActionContributionItem.access$0(ActionContributionItem.
java:352)
	at 
org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent(Actio
nContributionItem.java:47)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java(Compiled 
Code))
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java(Compiled 
Code))
	at 
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java(Compiled Code))
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java(Compiled 
Code))
	at 
org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java(Compiled Code))
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:656)
	at 
org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:81
5)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:151)
	at org.eclipse.core.launcher.Main.run(Main.java:433)
	at org.eclipse.core.launcher.Main.main(Main.java:306)
Comment 1 rolarenfan CLA 2002-01-04 10:22:16 EST
For "warning panel before call stack" read "warning panel before stack trace". 

The String index in the stack trace = -(length of package name).

Somewhat erratic -- some combinations of package and plugin.java-file names are 
accepted; examples of rejected pairs (package, plugin.java) are (ForRename, 
ThePlugin.java), (ForRename, MyPlugin.java), (ForRenamePI, ThePlugin.java), 
(ForRenamePI, MyPlugin.java); examples of accepted pairs (RenamerPI, 
ThePlugin.java), (RenamerPI, MyPlugin.java).
Comment 2 Erich Gamma CLA 2002-01-07 05:03:29 EST
pls investigate whether this is still a problem in the 2.0 stream
Comment 3 Adam Kiezun CLA 2002-01-07 05:36:27 EST
reproduced on 1.0 rollup - exact steps:
1. create package Foo
2. class FooPlugin in Foo
3. renaming fails

Comment 4 Adam Kiezun CLA 2002-01-07 05:45:21 EST
confirmed that the problem does not exist in the 2.0 stream
(it was caused by a faulty heuristic used in 1.0 - that has been improved since)