Bug 85019 - [typing] IndexOutOfBounds while moving text with cut/paste
Summary: [typing] IndexOutOfBounds while moving text with cut/paste
Status: RESOLVED DUPLICATE of bug 123783
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.2 RC1   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-11 11:41 EST by Nick Edgar CLA
Modified: 2006-04-04 05:20 EDT (History)
2 users (show)

See Also:


Attachments
The file before the change (1.61 KB, application/octet-stream)
2005-02-11 11:42 EST, Nick Edgar CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Edgar CLA 2005-02-11 11:41:04 EST
build I20050209-0800

- was editing a Java file
- cut and pasted some text, may have done a bit of other editing
- got the following in the log:

!ENTRY org.eclipse.ui 4 0 2005-02-11 11:36:33.496
!MESSAGE Index out of bounds
!STACK 0
java.lang.IllegalArgumentException: Index out of bounds
	at org.eclipse.swt.SWT.error(SWT.java:2823)
	at org.eclipse.swt.SWT.error(SWT.java:2762)
	at org.eclipse.swt.SWT.error(SWT.java:2733)
	at org.eclipse.swt.custom.StyledText.replaceStyleRanges(StyledText.java:6289)
	at org.eclipse.jface.text.TextViewer.addPresentation(TextViewer.java:4202)
	at org.eclipse.jface.text.TextViewer.changeTextPresentation(TextViewer.java:4281)
	at
org.eclipse.jface.text.presentation.PresentationReconciler.applyTextRegionCollection(PresentationReconciler.java:573)
	at
org.eclipse.jface.text.presentation.PresentationReconciler.processDamage(PresentationReconciler.java:562)
	at
org.eclipse.jface.text.presentation.PresentationReconciler.access$3(PresentationReconciler.java:558)
	at
org.eclipse.jface.text.presentation.PresentationReconciler$InternalListener.textChanged(PresentationReconciler.java:224)
	at org.eclipse.jface.text.TextViewer.updateTextListeners(TextViewer.java:2341)
	at
org.eclipse.jface.text.TextViewer$VisibleDocumentListener.documentChanged(TextViewer.java:319)
	at
org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged2(AbstractDocument.java:714)
	at
org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:677)
	at
org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:662)
	at
org.eclipse.jface.text.AbstractDocument.fireDocumentChanged(AbstractDocument.java:739)
	at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1030)
	at
org.eclipse.jdt.internal.ui.javaeditor.PartiallySynchronizedDocument.replace(PartiallySynchronizedDocument.java:92)
	at
org.eclipse.jface.text.DefaultDocumentAdapter.replaceTextRange(DefaultDocumentAdapter.java:238)
	at org.eclipse.swt.custom.StyledText.modifyContent(StyledText.java:5661)
	at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:6499)
	at org.eclipse.swt.custom.StyledText.doDelete(StyledText.java:2651)
	at org.eclipse.swt.custom.StyledText.cut(StyledText.java:2399)
	at org.eclipse.jface.text.TextViewer.doOperation(TextViewer.java:3490)
	at org.eclipse.jface.text.source.SourceViewer.doOperation(SourceViewer.java:786)
	at
org.eclipse.jface.text.source.projection.ProjectionViewer.doOperation(ProjectionViewer.java:1335)
	at
org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer.doOperation(JavaSourceViewer.java:155)
	at
org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:199)
	at
org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAction.doCutCopyWithImportsOperation(ClipboardOperationAction.java:326)
	at
org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAction.internalDoOperation(ClipboardOperationAction.java:278)
	at
org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAction$1.run(ClipboardOperationAction.java:247)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
	at
org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAction.run(ClipboardOperationAction.java:245)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:989)
	at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:188)
	at org.eclipse.ui.internal.commands.Command.execute(Command.java:130)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:445)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:724)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:767)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:536)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$2(WorkbenchKeyboard.java:479)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard$1.handleEvent(WorkbenchKeyboard.java:221)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:782)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:841)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:866)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:851)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:879)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:875)
	at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1181)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3153)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:3034)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:3467)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1600)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2529)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1585)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1551)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:290)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102)
	at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:227)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:276)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:131)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
	at java.lang.reflect.Method.invoke(Method.java:391)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:261)
	at org.eclipse.core.launcher.Main.run(Main.java:817)
	at org.eclipse.core.launcher.Main.main(Main.java:801)
Comment 1 Nick Edgar CLA 2005-02-11 11:42:09 EST
Created attachment 17859 [details]
The file before the change
Comment 2 Nick Edgar CLA 2005-02-11 11:43:56 EST
I was trying to change postWindowOpen() in the attached file to:

    public void postWindowOpen() {
        IWorkbenchPage page = getWindowConfigurer().getWindow().getActivePage();
        wbAdvisor.validate(page);
    }

by cutting the argument to validate, pasting it in the previous line, and adding:
IWorkbenchPage page = 

I tried reverting, closing and reopening the file and trying the edit again, but
I was unable to reproduce the error.
Comment 3 Dani Megert CLA 2005-02-11 12:28:05 EST
Needs to be assest for M5.

Was folding enabled?
Comment 4 Nick Edgar CLA 2005-02-11 12:54:14 EST
No, I have folding turned off by default.
Comment 5 Dani Megert CLA 2005-02-14 09:55:25 EST
Could not find a reproducible case yet.
Comment 6 Adam Kiezun CLA 2005-05-27 15:55:04 EDT
FYI: I just saw the same bug on 3.1M7
no idea how it happened
Comment 7 Adam Kiezun CLA 2005-05-27 16:02:31 EDT
ha! got the bugger. I have a reprodicible case.

0. default folding and other editor settings
1. create this class:
package p;
public class A {
	void fooBarBaz(){
	}
}

2. now, place the caret inside the method name
3. place the mouse cursor over the method name and use ctrl to activate the
hyperlink. keep the ctrl key down!
4. now, while holding ctrl, press d (to cut line)
5. boom! happens here everytime

Comment 8 Adam Kiezun CLA 2005-05-27 16:04:21 EDT
i reopened but please feel free to close if this is below the rc1 prority threshold
Comment 9 Adam Kiezun CLA 2005-05-27 16:16:49 EDT
correction: it does not actually happen _every_ time
I just saw it going away. I had to close and reopen eclipse to make it happen again.
Btw, the described sequence of actions (when you delete a hyperlinked line) can
lead to other funny things - like random pieces of code looking like hyperlinks.
will post a bug when i have a scenario
Comment 10 Adam Kiezun CLA 2005-05-27 16:25:52 EDT
re comment 9 see bug 97081 
Comment 11 Dani Megert CLA 2005-05-30 03:51:57 EDT
Adam, I can easily reproduce bug 97081 but not this one. Tried many times. 
Comment 12 Rafael Chaves CLA 2005-06-08 16:11:14 EDT
Got this once during an undo with n200506080010 (inner exception only):

Caused by: java.lang.IllegalArgumentException: Index out of bounds
	at org.eclipse.swt.SWT.error(SWT.java:2924)
	at org.eclipse.swt.SWT.error(SWT.java:2863)
	at org.eclipse.swt.SWT.error(SWT.java:2834)
	at org.eclipse.swt.custom.StyledText.replaceStyleRanges(StyledText.java:6426)
	at org.eclipse.jface.text.TextViewer.addPresentation(TextViewer.java:4211)
	at org.eclipse.jface.text.TextViewer.changeTextPresentation(TextViewer.java:4290)
	at
org.eclipse.jface.text.presentation.PresentationReconciler.applyTextRegionCollection(PresentationReconciler.java:573)
	at
org.eclipse.jface.text.presentation.PresentationReconciler.processDamage(PresentationReconciler.java:562)
	at
org.eclipse.jface.text.presentation.PresentationReconciler.access$3(PresentationReconciler.java:558)
	at
org.eclipse.jface.text.presentation.PresentationReconciler$InternalListener.textChanged(PresentationReconciler.java:224)
	at org.eclipse.jface.text.TextViewer.updateTextListeners(TextViewer.java:2373)
	at org.eclipse.jface.text.TextViewer.fireRedrawChanged(TextViewer.java:4457)
	at org.eclipse.jface.text.TextViewer.enabledRedrawing(TextViewer.java:4537)
	at org.eclipse.jface.text.TextViewer.enabledRedrawing(TextViewer.java:4496)
	at org.eclipse.jface.text.TextViewer.setRedraw(TextViewer.java:4619)
	at org.eclipse.jface.text.TextViewer.setRedraw(TextViewer.java:4591)
	at
org.eclipse.jface.text.DefaultUndoManager$CompoundTextCommand.undo(DefaultUndoManager.java:410)
	at
org.eclipse.core.commands.operations.DefaultOperationHistory.doUndo(DefaultOperationHistory.java:417)
	... 52 more

Sorry, cannot reproduce.
Comment 13 Dani Megert CLA 2005-06-16 06:23:11 EDT
Resetting priority to P3. Will be reassessed for the next release.
Comment 14 Al B CLA 2005-08-06 17:58:48 EDT
I am also getting the same exception in 3.1.0 (Build id: I20050627-1435).

java.lang.IllegalArgumentException: Index out of bounds
at org.eclipse.swt.SWT.error(SWT.java:2926)
at org.eclipse.swt.SWT.error(SWT.java:2865)
at org.eclipse.swt.SWT.error(SWT.java:2836)
at org.eclipse.swt.widgets.Widget.error(Widget.java:395)
at org.eclipse.swt.widgets.TreeItem.<init>(TreeItem.java:130)
at
org.eclipse.ui.views.properties.PropertySheetViewer.createItem(PropertySheetViewer.java:347)
at
org.eclipse.ui.views.properties.PropertySheetViewer.updateChildrenOf(PropertySheetViewer.java:1177)
at
org.eclipse.ui.views.properties.PropertySheetViewer.access$2(PropertySheetViewer.java:1101)
at
org.eclipse.ui.views.properties.PropertySheetViewer$3.childEntriesChanged(PropertySheetViewer.java:308)
at
org.eclipse.ui.views.properties.PropertySheetEntry.fireChildEntriesChanged(PropertySheetEntry.java:295)
at
org.eclipse.ui.views.properties.PropertySheetEntry.refreshChildEntries(PropertySheetEntry.java:559)
at
org.eclipse.ui.views.properties.PropertySheetEntry.setValues(PropertySheetEntry.java:735)
at
org.eclipse.ui.views.properties.PropertySheetViewer.setInput(PropertySheetViewer.java:875)
at
org.eclipse.ui.views.properties.PropertySheetPage.selectionChanged(PropertySheetPage.java:392)
at
org.eclipse.ui.views.properties.PropertySheet.selectionChanged(PropertySheet.java:212)
at
org.eclipse.ui.internal.AbstractSelectionService.fireSelection(AbstractSelectionService.java:156)
at
org.eclipse.ui.internal.AbstractSelectionService.setActivePart(AbstractSelectionService.java:278)
at
org.eclipse.ui.internal.WorkbenchPagePartList.fireActivePartChanged(WorkbenchPagePartList.java:59)
at org.eclipse.ui.internal.PartList.setActivePart(PartList.java:108)
at org.eclipse.ui.internal.WorkbenchPage.setActivePart(WorkbenchPage.java:2859)
at org.eclipse.ui.internal.WorkbenchPage.requestActivation(WorkbenchPage.java:2471)
at org.eclipse.ui.internal.PartPane.requestActivation(PartPane.java:249)
at org.eclipse.ui.internal.PartPane.handleEvent(PartPane.java:214)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:867)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:848)
at org.eclipse.swt.widgets.Shell.setActiveControl(Shell.java:998)
at org.eclipse.swt.widgets.Shell.WM_MOUSEACTIVATE(Shell.java:1635)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:3079)
at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1582)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:3706)
at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:1651)
at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:77)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:3123)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:3706)
at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:1651)
at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:77)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:3123)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:3706)
at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:1651)
at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:77)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:3123)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:3706)
at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:1651)
at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:77)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:3123)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:3706)
at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:1580)
at org.eclipse.swt.widgets.Tree.callWindowProc(Tree.java:229)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:3123)
at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:2391)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:3706)
at org.eclipse.swt.internal.win32.OS.PeekMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.PeekMessage(OS.java:2111)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2708)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
at org.eclipse.core.launcher.Main.run(Main.java:973)
at org.eclipse.core.launcher.Main.main(Main.java:948)
Comment 15 Dani Megert CLA 2005-08-08 04:46:04 EDT
If you look at the stack trace you'll see that this is unrelated.
Comment 16 Dani Megert CLA 2006-04-04 05:20:36 EDT

*** This bug has been marked as a duplicate of 123783 ***