Bug 6385 - java.lang.StringIndexOutOfBoundsException during open type action
Summary: java.lang.StringIndexOutOfBoundsException during open type action
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: Claude Knaus CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 6720 6788 (view as bug list)
Depends on: 6839
Blocks:
  Show dependency tree
 
Reported: 2001-11-28 11:11 EST by Olivier Thomann CLA
Modified: 2002-02-08 05:35 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2001-11-28 11:11:19 EST
From an email following an EC message.

I was using R1.0 (Build 0.127) when I was getting this problem. After obtaining 
the latest build (1127) I did not get the compiler error. But there were two 
other problems :
[...]

I hit the Type Viewer button again. This time it seemed to index all the files,  
but stopped at the last one and failed 
with an exception saying - please see log.

The message in the log is :

1 org.eclipse.core.resources 4 Unhandled exception caught in event loop.
Log: Tue Nov 27 18:20:38 MST 2001
4 org.eclipse.ui 0 String index out of range: 0
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
		 at java.lang.String.charAt(Unknown Source)
		 at 
org.eclipse.jdt.internal.ui.dialogs.TypeSelectionDialog$StringComparator.compare
(TypeSelectionDialog.java:90)
		 at 
org.eclipse.jdt.internal.ui.dialogs.FilteredList$LabelComparator.compare(Filtere
dList.java:125)
		 at 
org.eclipse.jdt.internal.ui.dialogs.TwoArrayQuickSorter.internalSort(TwoArrayQui
ckSorter.java:78)
		 at 
org.eclipse.jdt.internal.ui.dialogs.TwoArrayQuickSorter.sort(TwoArrayQuickSorter
.java:66)
		 at 
org.eclipse.jdt.internal.ui.dialogs.FilteredList.setElements(FilteredList.java:2
07)
		 at 
org.eclipse.jdt.internal.ui.dialogs.AbstractElementListSelectionDialog.setListEl
ements(AbstractElementListSelectionDialog.java:160)
		 at 
org.eclipse.jdt.internal.ui.dialogs.TwoPaneElementSelector.createDialogArea(TwoP
aneElementSelector.java:98)
		 at 
org.eclipse.jdt.internal.ui.dialogs.OpenTypeSelectionDialog.createDialogArea(Ope
nTypeSelectionDialog.java:82)
		 at 
org.eclipse.jface.dialogs.Dialog.createContents(Dialog.java:301)
		 at org.eclipse.jface.window.Window.create(Window.java:237)
		 at 
org.eclipse.jdt.internal.ui.dialogs.SelectionStatusDialog.create(SelectionStatus
Dialog.java:132)
		 at 
org.eclipse.jdt.internal.ui.dialogs.AbstractElementListSelectionDialog.create(Ab
stractElementListSelectionDialog.java:407)
		 at 
org.eclipse.jdt.internal.ui.dialogs.TypeSelectionDialog.create(TypeSelectionDial
og.java:130)
		 at org.eclipse.jface.window.Window.open(Window.java:510)
		 at 
org.eclipse.jdt.internal.ui.dialogs.AbstractElementListSelectionDialog.access$su
perOpen(AbstractElementListSelectionDialog.java:400)
		 at 
org.eclipse.jdt.internal.ui.dialogs.AbstractElementListSelectionDialog.access$2(
AbstractElementListSelectionDialog.java:399)
		 at 
org.eclipse.jdt.internal.ui.dialogs.AbstractElementListSelectionDialog$4.run(Abs
tractElementListSelectionDialog.java:393)
		 at 
org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:56)
		 at 
org.eclipse.jdt.internal.ui.dialogs.AbstractElementListSelectionDialog.open(Abst
ractElementListSelectionDialog.java:391)
		 at 
org.eclipse.jdt.internal.ui.dialogs.TypeSelectionDialog.open(TypeSelectionDialog
.java:163)
		 at 
org.eclipse.jdt.internal.ui.actions.OpenTypeAction.run(OpenTypeAction.java:52)
		 at 
org.eclipse.jdt.internal.ui.actions.OpenTypeAction.run(OpenTypeAction.java:77)
		 at 
org.eclipse.ui.internal.PluginAction.run(PluginAction.java:176)
		 at 
org.eclipse.jface.action.Action.runWithEvent(Action.java:452)
		 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.EventTable.sendEvent(EventTable.java:54)
		 at 
org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:635)
		 at 
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1368)
		 at 
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1170)
		 at 
org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:775)
		 at org.eclipse.ui.internal.Workbench.run(Workbench.java:758)
		 at 
org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:82
0)
		 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:502)
		 at org.eclipse.core.launcher.Main.main(Main.java:362)
Comment 1 Claude Knaus CLA 2001-11-28 12:52:22 EST
I'm not checking for Type names which are empty. I would assume that any type
has a name with a length >= 1.

I could make it more robust by checking for empty type names, but that would
introduce additional overhead for sorting.

I'd like to know how it is possible that a type name happens to be empty and
if I should deal with it.
Comment 2 Erich Gamma CLA 2001-12-04 05:57:23 EST
make the code save and log when the problem occurs.
Comment 3 Claude Knaus CLA 2001-12-04 06:48:21 EST
implemented workaround > 20011127

the bug remains open to understand why the type name can be empty.
Comment 4 Claude Knaus CLA 2001-12-07 08:08:09 EST
fixed a bug in the workaround > 20011206.
Comment 5 Claude Knaus CLA 2001-12-07 08:12:11 EST
Olivier, can you figure out why the type name happens to be empty and file an
appropriate bug? I can't reproduce this behaviour with my workspace.
Comment 6 Claude Knaus CLA 2001-12-10 10:34:13 EST
*** Bug 6720 has been marked as a duplicate of this bug. ***
Comment 7 Claude Knaus CLA 2001-12-10 10:35:23 EST
Will look into it and identify the component which is failing to produce 
correct type names.
Comment 8 Boris Pruessmann CLA 2001-12-10 10:56:47 EST
I am not quite sure that this is the same as 6720, because I was able to 
workaround the problem (#6720) by using an older version of 
org.eclipse.jdt.internal.ui.dialogs.FilteredList.LabelComparator (two weeks 
old). #6720 seemed to be a problem introduced by case-sensitivity of the dialog 
(?) ...
Comment 9 Claude Knaus CLA 2001-12-10 11:28:37 EST
Trust me. It is the same bug.
Comment 10 Olivier Thomann CLA 2001-12-10 12:27:50 EST
Sorry I cannot help. I didn't get the case myself. I simply entered a PR related 
to a message on EC.
Comment 11 Claude Knaus CLA 2001-12-10 13:14:42 EST
no problem... see bug #6720. I should be able to reproduce it, once I get hold 
of this mail api.
Comment 12 Erich Gamma CLA 2001-12-11 09:50:57 EST
*** Bug 6788 has been marked as a duplicate of this bug. ***
Comment 13 Claude Knaus CLA 2001-12-11 13:21:36 EST
I reproduced it. Duh, the search engine is returning anonymous types!
Comment 14 Claude Knaus CLA 2001-12-12 07:00:38 EST
workaround in > 20011211

This bug remains open until the issue with #6839 is cleared.
Comment 15 Mariano Kamp CLA 2001-12-19 13:17:58 EST
subject: java.lang.StringIndexOutOfBoundsException: type name was empty

I am a bit confused. The bug I intended to add my comments to is marked as 
duplicated to this one, but I don't see too much similarities. Still I believe 
the "trust me" stated below.

Anyway. With the stable build as of 20011206 I get an error dialog when opening 
the type browser CTRL+SHIFT+T when (trying to) use it on a big project, i.e. 
with many libraries. I just try to open it, but even before the input dialog 
appears I get the error dialog.

Below I pasted the data from the log. The message is repeated for 455kb:



Log: Wed Dec 19 19:18:38 CET 2001
4 org.eclipse.jdt.ui 1 Internal Error
java.lang.StringIndexOutOfBoundsException: type name was empty
	at 
org.eclipse.jdt.internal.ui.dialogs.TypeSelectionDialog$StringComparator.compare
(TypeSelectionDialog.java:94)
	at 
org.eclipse.jdt.internal.ui.dialogs.FilteredList$LabelComparator.compare
(FilteredList.java:125)
	at org.eclipse.jdt.internal.ui.dialogs.TwoArrayQuickSorter.internalSort
(TwoArrayQuickSorter.java:78)
	at org.eclipse.jdt.internal.ui.dialogs.TwoArrayQuickSorter.sort
(TwoArrayQuickSorter.java:66)
	at org.eclipse.jdt.internal.ui.dialogs.FilteredList.setElements
(FilteredList.java:207)
	at 
org.eclipse.jdt.internal.ui.dialogs.AbstractElementListSelectionDialog.setListEl
ements(AbstractElementListSelectionDialog.java:160)
	at 
org.eclipse.jdt.internal.ui.dialogs.TwoPaneElementSelector.createDialogArea
(TwoPaneElementSelector.java:98)
	at 
org.eclipse.jdt.internal.ui.dialogs.OpenTypeSelectionDialog.createDialogArea
(OpenTypeSelectionDialog.java:82)
	at org.eclipse.jface.dialogs.Dialog.createContents(Dialog.java:301)
	at org.eclipse.jface.window.Window.create(Window.java:237)
	at org.eclipse.jdt.internal.ui.dialogs.SelectionStatusDialog.create
(SelectionStatusDialog.java:132)
	at 
org.eclipse.jdt.internal.ui.dialogs.AbstractElementListSelectionDialog.create
(AbstractElementListSelectionDialog.java:407)
	at org.eclipse.jdt.internal.ui.dialogs.TypeSelectionDialog.create
(TypeSelectionDialog.java:142)
	at org.eclipse.jface.window.Window.open(Window.java:510)
	at 
org.eclipse.jdt.internal.ui.dialogs.AbstractElementListSelectionDialog.access$su
perOpen(AbstractElementListSelectionDialog.java:400)
	at 
org.eclipse.jdt.internal.ui.dialogs.AbstractElementListSelectionDialog.access$2
(AbstractElementListSelectionDialog.java:399)
	at 
org.eclipse.jdt.internal.ui.dialogs.AbstractElementListSelectionDialog$4.run
(AbstractElementListSelectionDialog.java:393)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:56)
	at 
org.eclipse.jdt.internal.ui.dialogs.AbstractElementListSelectionDialog.open
(AbstractElementListSelectionDialog.java:391)
	at org.eclipse.jdt.internal.ui.dialogs.TypeSelectionDialog.open
(TypeSelectionDialog.java:175)
	at org.eclipse.jdt.internal.ui.actions.OpenTypeAction.run
(OpenTypeAction.java:52)
	at org.eclipse.jdt.internal.ui.actions.OpenTypeAction.run
(OpenTypeAction.java:77)
	at org.eclipse.ui.internal.PluginAction.run(PluginAction.java:181)
	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:54)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:635)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1368)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1170)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:775)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:758)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:820)
	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:502)
	at org.eclipse.core.launcher.Main.main(Main.java:362)
Log: Wed Dec 19 19:18:38 CET 2001
4 org.eclipse.jdt.ui 1 Internal Error
java.lang.StringIndexOutOfBoundsException: type name was empty
	at 
org.eclipse.jdt.internal.ui.dialogs.TypeSelectionDialog$StringComparator.compare
(TypeSelectionDialog.java:94)
	at 
org.eclipse.jdt.internal.ui.dialogs.FilteredList$LabelComparator.compare
(FilteredList.java:125)
	at org.eclipse.jdt.internal.ui.dialogs.TwoArrayQuickSorter.internalSort
(TwoArrayQuickSorter.java:78)
	at org.eclipse.jdt.internal.ui.dialogs.TwoArrayQuickSorter.sort
(TwoArrayQuickSorter.java:66)
	at org.eclipse.jdt.internal.ui.dialogs.FilteredList.setElements
(FilteredList.java:207)
	at 
org.eclipse.jdt.internal.ui.dialogs.AbstractElementListSelectionDialog.setListEl
ements(AbstractElementListSelectionDialog.java:160)
	at 
org.eclipse.jdt.internal.ui.dialogs.TwoPaneElementSelector.createDialogArea
(TwoPaneElementSelector.java:98)
	at 
org.eclipse.jdt.internal.ui.dialogs.OpenTypeSelectionDialog.createDialogArea
(OpenTypeSelectionDialog.java:82)
	at org.eclipse.jface.dialogs.Dialog.createContents(Dialog.java:301)
	at org.eclipse.jface.window.Window.create(Window.java:237)
	at org.eclipse.jdt.internal.ui.dialogs.SelectionStatusDialog.create
(SelectionStatusDialog.java:132)
	at 
org.eclipse.jdt.internal.ui.dialogs.AbstractElementListSelectionDialog.create
(AbstractElementListSelectionDialog.java:407)
	at org.eclipse.jdt.internal.ui.dialogs.TypeSelectionDialog.create
(TypeSelectionDialog.java:142)
	at org.eclipse.jface.window.Window.open(Window.java:510)
	at 
org.eclipse.jdt.internal.ui.dialogs.AbstractElementListSelectionDialog.access$su
perOpen(AbstractElementListSelectionDialog.java:400)
	at 
org.eclipse.jdt.internal.ui.dialogs.AbstractElementListSelectionDialog.access$2
(AbstractElementListSelectionDialog.java:399)
	at 
org.eclipse.jdt.internal.ui.dialogs.AbstractElementListSelectionDialog$4.run
(AbstractElementListSelectionDialog.java:393)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:56)
	at 
org.eclipse.jdt.internal.ui.dialogs.AbstractElementListSelectionDialog.open
(AbstractElementListSelectionDialog.java:391)
	at org.eclipse.jdt.internal.ui.dialogs.TypeSelectionDialog.open
(TypeSelectionDialog.java:175)
	at org.eclipse.jdt.internal.ui.actions.OpenTypeAction.run
(OpenTypeAction.java:52)
	at org.eclipse.jdt.internal.ui.actions.OpenTypeAction.run
(OpenTypeAction.java:77)
	at org.eclipse.ui.internal.PluginAction.run(PluginAction.java:181)
	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:54)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:635)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1368)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1170)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:775)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:758)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:820)
	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:502)
	at org.eclipse.core.launcher.Main.main(Main.java:362)
Log: Wed Dec 19 19:18:38 CET 2001
4 org.eclipse.jdt.ui 1 Internal Error
java.lang.StringIndexOutOfBoundsException: type name was empty
	at 
org.eclipse.jdt.internal.ui.dialogs.TypeSelectionDialog$StringComparator.compare
(TypeSelectionDialog.java:94)
	at 
org.eclipse.jdt.internal.ui.dialogs.FilteredList$LabelComparator.compare
(FilteredList.java:125)
	at org.eclipse.jdt.internal.ui.dialogs.TwoArrayQuickSorter.internalSort
(TwoArrayQuickSorter.java:78)
	at org.eclipse.jdt.internal.ui.dialogs.TwoArrayQuickSorter.sort
(TwoArrayQuickSorter.java:66)
Comment 16 Claude Knaus CLA 2001-12-20 04:48:28 EST
As stated above, it has been fixed with a workaround in 20011211.
The only reason this bug is still open is because it depends on 6839. Once
that is fixed, I will be able to remove the workaround and mark this bug
finally as fixed.
Comment 17 Claude Knaus CLA 2002-02-08 05:35:08 EST
fixed > 20020207
finally removed workaround.