Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 67428 - [implementation] ArrayIndexOutOfBoundsException in BufferedRuleBasedScanner
Summary: [implementation] ArrayIndexOutOfBoundsException in BufferedRuleBasedScanner
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Christof Marti CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 63836 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-06-16 06:14 EDT by Gabriele Garuglieri CLA
Modified: 2004-06-18 12:03 EDT (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 Gabriele Garuglieri CLA 2004-06-16 06:14:13 EDT
3.0RC2 Build id: 200406111814
Getting from time to time the following sequence of errors while editing.
I cannot correlate the errors with any specific action since the edit session
seems to be not affected by them and i see the errors only if i look into the log.
Yesterday it happend five times, this morning one.


!ENTRY org.eclipse.ui 4 4 Jun 16, 2004 11:51:36.850
!MESSAGE Unhandled event loop exception

!ENTRY org.eclipse.ui 4 0 Jun 16, 2004 11:51:36.850
!MESSAGE Failed to execute runnable (java.lang.ArrayIndexOutOfBoundsException: -1)
!STACK 0
org.eclipse.swt.SWTException: Failed to execute runnable
(java.lang.ArrayIndexOutOfBoundsException: -1)
	at org.eclipse.swt.SWT.error(SWT.java:2691)
	at org.eclipse.swt.SWT.error(SWT.java:2616)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:109)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:2709)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2401)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1362)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1333)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:252)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:96)
	at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:334)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:272)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:128)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
	at org.eclipse.core.launcher.Main.run(Main.java:638)
	at org.eclipse.core.launcher.Main.main(Main.java:622)

!ENTRY org.eclipse.ui 4 4 Jun 16, 2004 11:51:36.850
!MESSAGE *** SWT nested exception

!ENTRY org.eclipse.ui 4 0 Jun 16, 2004 11:51:36.866
!MESSAGE -1
!STACK 0
java.lang.ArrayIndexOutOfBoundsException: -1
	at
org.eclipse.jface.text.rules.BufferedRuleBasedScanner.read(BufferedRuleBasedScanner.java:118)
	at
org.eclipse.jdt.internal.ui.text.CombinedWordRule.evaluate(CombinedWordRule.java:334)
	at
org.eclipse.jface.text.rules.RuleBasedScanner.nextToken(RuleBasedScanner.java:155)
	at
org.eclipse.jdt.internal.ui.text.AbstractJavaScanner.nextToken(AbstractJavaScanner.java:115)
	at
org.eclipse.jface.text.rules.DefaultDamagerRepairer.createPresentation(DefaultDamagerRepairer.java:166)
	at
org.eclipse.jface.text.presentation.PresentationReconciler.createPresentation(PresentationReconciler.java:446)
	at
org.eclipse.jface.text.presentation.PresentationReconciler.processDamage(PresentationReconciler.java:555)
	at
org.eclipse.jface.text.presentation.PresentationReconciler.access$3(PresentationReconciler.java:553)
	at
org.eclipse.jface.text.presentation.PresentationReconciler$InternalListener.textChanged(PresentationReconciler.java:222)
	at org.eclipse.jface.text.TextViewer.updateTextListeners(TextViewer.java:2235)
	at org.eclipse.jface.text.TextViewer.fireRedrawChanged(TextViewer.java:4268)
	at org.eclipse.jface.text.TextViewer.enabledRedrawing(TextViewer.java:4338)
	at org.eclipse.jface.text.TextViewer.setRedraw(TextViewer.java:4415)
	at
org.eclipse.jface.text.source.projection.ProjectionViewer.catchupWithProjectionAnnotationModel(ProjectionViewer.java:868)
	at
org.eclipse.jface.text.source.projection.ProjectionViewer.access$5(ProjectionViewer.java:821)
	at
org.eclipse.jface.text.source.projection.ProjectionViewer$1.run(ProjectionViewer.java:792)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:106)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:2709)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2401)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1362)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1333)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:252)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:96)
	at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:334)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:272)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:128)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
	at org.eclipse.core.launcher.Main.run(Main.java:638)
	at org.eclipse.core.launcher.Main.main(Main.java:622)
Comment 1 Dani Megert CLA 2004-06-16 14:46:47 EDT
We cannot fix this without a test case.

Reasons why we get the IOOBE:
- RuleBasedScanner.setRange directly sets the offset. This method is called from
the damager with the damaged region. if getDamagedRegion(...) returns a negative
offset then it will also in the scanner (region is not protected against
negative values)
- some code has more calls to scanner.unread() than to scanner.read()
Comment 2 Dani Megert CLA 2004-06-16 14:50:09 EDT
*** Bug 63836 has been marked as a duplicate of this bug. ***
Comment 3 Gabriele Garuglieri CLA 2004-06-17 02:27:01 EDT
Daniel,
i understand your point, but i cannot reproduce it at will.
I keep the error log view opened while editing and when i see popping out the
error i try to reply the last actions i did before the error, but up to now i
had no luck, it just happens when... it decides to happen.
Comment 4 Christof Marti CLA 2004-06-17 03:23:24 EDT
Do you have advanced highlighting enabled?
Comment 5 Gabriele Garuglieri CLA 2004-06-17 03:35:52 EDT
Yes i do.
Comment 6 Christof Marti CLA 2004-06-17 13:38:07 EDT
Could you check whether the problem disappears if you disable advanced highlighting?
Comment 7 Erich Gamma CLA 2004-06-17 17:17:03 EDT
should fix for RC3
Comment 8 Gabriele Garuglieri CLA 2004-06-18 01:36:41 EDT
I'll try, but last days i did extensive changes in many classes and it was
frequent, now i'm working on the build/deploy part of the project and since
yesterday it didn't happen any longer.
I'll let you know if it recurs again.
Comment 9 Christof Marti CLA 2004-06-18 12:03:47 EDT
Reviewed by DM. Fixed in HEAD. Will be released in I200406181600.

The semantic highlighting uses its own PresentationReconciler in the background
thread. Without the fix, the same scanners as in the main thread were used,
which can result in more calls to unread() than read(). This would explain the
exception. However, a call to setRange(..) with a negative offset could also
trigger this. I will open a new PR for adding an assertion to setRange(..) post 3.0.