Bug 314620 - java.lang.ArrayIndexOutOfBoundsException in org.eclipse.swt.graphics.TextLayout.computeRuns
Summary: java.lang.ArrayIndexOutOfBoundsException in org.eclipse.swt.graphics.TextLayo...
Status: CLOSED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2010-05-27 05:02 EDT by Jens Seidel CLA
Modified: 2018-07-06 13:49 EDT (History)
7 users (show)

See Also:


Attachments
prints (1.62 KB, patch)
2010-05-28 13:58 EDT, Felipe Heidrich CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jens Seidel CLA 2010-05-27 05:02:34 EDT
Build Identifier: I20100513-1500

eclipse.buildId=I20100513-1500
java.version=1.6.0_18
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=de_DE
Command-line arguments:  -os linux -ws gtk -arch x86


Error
Thu May 27 10:56:43 CEST 2010
Unhandled event loop exception

org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.ArrayIndexOutOfBoundsException: 346)
	at org.eclipse.swt.SWT.error(SWT.java:4083)
	at org.eclipse.swt.SWT.error(SWT.java:3998)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:137)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3515)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3162)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2624)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2588)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2422)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 346
	at org.eclipse.swt.graphics.TextLayout.computeRuns(TextLayout.java:147)
	at org.eclipse.swt.graphics.TextLayout.getBounds(TextLayout.java:910)
	at org.eclipse.swt.custom.StyledTextRenderer.calculate(StyledTextRenderer.java:212)
	at org.eclipse.swt.custom.StyledTextRenderer$1.run(StyledTextRenderer.java:242)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
	... 22 more



Reproducible: Didn't try
Comment 1 Jens Seidel CLA 2010-05-27 05:09:29 EDT
And another backtrace ...

It seems to be reproducable with one a git project. I just have to change into the History View to get this.

eclipse.buildId=I20100513-1500
java.version=1.6.0_18
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=de_DE
Command-line arguments:  -os linux -ws gtk -arch x86


Error
Thu May 27 11:07:24 CEST 2010
Problems occurred when invoking code from plug-in: "org.eclipse.jface".

java.lang.ArrayIndexOutOfBoundsException: 97
	at org.eclipse.swt.graphics.TextLayout.computeRuns(TextLayout.java:147)
	at org.eclipse.swt.graphics.TextLayout.getBounds(TextLayout.java:910)
	at org.eclipse.swt.custom.StyledTextRenderer.calculate(StyledTextRenderer.java:212)
	at org.eclipse.swt.custom.StyledTextRenderer.getLineHeight(StyledTextRenderer.java:568)
	at org.eclipse.swt.custom.StyledText.getLinePixel(StyledText.java:4187)
	at org.eclipse.swt.custom.StyledText.getPointAtOffset(StyledText.java:5453)
	at org.eclipse.swt.custom.StyledText.setCaretLocation(StyledText.java:8324)
	at org.eclipse.swt.custom.StyledText.setSelectionRange(StyledText.java:9507)
	at org.eclipse.jface.text.TextViewer.findAndSelect(TextViewer.java:4627)
	at org.eclipse.egit.ui.internal.history.CommitMessageViewer.selectionChanged(CommitMessageViewer.java:373)
	at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:162)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
	at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:160)
	at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:2162)
	at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredViewer.java:1190)
	at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(StructuredViewer.java:1220)
	at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenStrategy.java:228)
	at org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.java:222)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:389)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1234)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3540)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3159)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2624)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2588)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2422)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
Comment 2 Felipe Heidrich CLA 2010-05-27 10:45:06 EDT
Please provido more details on how to reproduce the problem.
Do I need to install a plugin for git ? What do I do from there ?

Note: we fixed two AIOOBE in TextLayout recently: bug 308329 and bug 295513.
Comment 3 Jens Seidel CLA 2010-05-27 11:13:13 EDT
(In reply to comment #2)
> Please provido more details on how to reproduce the problem.
> Do I need to install a plugin for git ? What do I do from there ?

Yes, install
 Eclipse EGit Feature (Incubation)	0.7.1	org.eclipse.egit.feature.group
and
  Eclipse JGit Feature (Incubation)	0.7.1	org.eclipse.jgit.feature.group
(just search for plugins containing "git", they are available by default, no need to add a special update size).

Now you have to open a git project. Select from the project context menu Team -> Show in Resource History. That's all and you should get the bug in seconds.

> Note: we fixed two AIOOBE in TextLayout recently: bug 308329 and bug 295513.

I upgraded to I20100520-1744 which is only one week old. The bug still exists.

I tried to reproduce with a different git repository than mine but failed. Imported: http://github.com/aptana/studio.git

Maybe you're more lucky reproducing it ...
Comment 4 Felipe Heidrich CLA 2010-05-27 11:48:03 EDT
(In reply to comment #3)
> Maybe you're more lucky reproducing it ...

No luck here, anything else I can try to reproduce this problem on my machine (which is by far the best way for me to work on the bug) ?

One last option is I sending you a debug version of SWT to collect more info.
Comment 5 Jens Seidel CLA 2010-05-28 04:39:52 EDT
(In reply to comment #4)
> (In reply to comment #3)
> > Maybe you're more lucky reproducing it ...
> 
> No luck here, anything else I can try to reproduce this problem on my machine
> (which is by far the best way for me to work on the bug) ?

No, I'm sorry. I tried to reproduce it also with the linux kernel, ... no success.
 
> One last option is I sending you a debug version of SWT to collect more info.

Yes, you can do this. I can also patch and recompile eclipse myself if you tell me how (I'm a C++ guy).
Comment 6 Felipe Heidrich CLA 2010-05-28 13:45:28 EDT
(In reply to comment #5)
> Yes, you can do this. I can also patch and recompile eclipse myself if you tell
> me how (I'm a C++ guy).

I find it easy to download SWT from CVS, apply the patches, and self-host eclipse.
Then in the self-hosted eclipse you reproduce the problem.
See http://www.eclipse.org/swt/cvs.php
Comment 7 Felipe Heidrich CLA 2010-05-28 13:58:14 EDT
Created attachment 170395 [details]
prints

Please, try this patch and report back the output it gives when the problem occurs. Thank you.
Comment 8 Jens Seidel CLA 2010-05-30 15:27:31 EDT
(In reply to comment #7)
> Created an attachment (id=170395) [details]
> prints
> 
> Please, try this patch and report back the output it gives when the problem
> occurs. Thank you.

Heh, it seems I was able to do so!

There where really many output lines. The first visible in the console (but it was probably truncated) are:

segmentsText:\uffe1\uffc0\uffe2\uffe3j\uffca\ufff8\uffed\uff84\ufffdp\uffff\uff91{\ufffe\uffbf\ufffd\uffed\uffd5\uffe9\uff8a\uff88\uffb8g\ufff9\uff82\uffff\uffdb\uffc7V\ufffbm
segmentsText.length:36
ascent:12
descent:3
nSegments:0
lineCount:5
strlen:88
java.lang.ArrayIndexOutOfBoundsException: 46
	at org.eclipse.swt.graphics.TextLayout.computeRuns(TextLayout.java:147)
	at org.eclipse.swt.graphics.TextLayout.getBounds(TextLayout.java:929)
	at org.eclipse.swt.custom.StyledTextRenderer.calculate(StyledTextRenderer.java:212)
	at org.eclipse.swt.custom.StyledTextRenderer$1.run(StyledTextRenderer.java:242)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3527)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3174)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
segmentsText:\uffd7\uffb5_\uffcd"\uffbe\uffe2\uffffw2\uff8d\uffc0\ufffd\uffefV\uffb4\uffdf!\uffff\uffdd\ufffb\ufff7\uffbe\\uff8b\ufff7;\uffa9\ufffd\uffaa\uffba;N\uffe8\uffddeG,jp\ufff8\ufff3\uffa8\uffa3\uffd9
segmentsText.length:54
ascent:12
descent:3
nSegments:0
lineCount:6
strlen:114
java.lang.ArrayIndexOutOfBoundsException: 67
	at org.eclipse.swt.graphics.TextLayout.computeRuns(TextLayout.java:147)
	at org.eclipse.swt.graphics.TextLayout.getBounds(TextLayout.java:929)
	at org.eclipse.swt.custom.StyledTextRenderer.calculate(StyledTextRenderer.java:212)
	at org.eclipse.swt.custom.StyledTextRenderer$1.run(StyledTextRenderer.java:242)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3527)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3174)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
segmentsText:\uffb0\uff8e\uffc5\uff8d\uff8c\ufff7@\uffdf\uffa4\uffae%f1\uff9d\ufff8U\uffa4\uff83U\uff80n\uffb8Zd\uffda\uffef}\uff81\uff88^\uffff\uffc7\ufff7~\ufff5\uff95_}\ufff3{o\uffde~\uffae\uffbb\ufffb\uffc9O}\ufffa\uff93\uff9f\uffba\ufffb\uffb1\uffbb\uffdd\uff87\uffbb7\uffbf\ufffb\uffe6\uffe7\uffe5\ufff3\uffaf\uffff\uffe3\uffd7ONNP\uffa8\uffbe\uffa1\uffbe\uff99\e\uffda
segmentsText.length:91
ascent:12
descent:3
nSegments:0
lineCount:12
strlen:203
java.lang.ArrayIndexOutOfBoundsException: 115
	at org.eclipse.swt.graphics.TextLayout.computeRuns(TextLayout.java:148)
	at org.eclipse.swt.graphics.TextLayout.getBounds(TextLayout.java:929)
	at org.eclipse.swt.custom.StyledTextRenderer.calculate(StyledTextRenderer.java:212)
	at org.eclipse.swt.custom.StyledTextRenderer$1.run(StyledTextRenderer.java:242)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3527)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3174)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
segmentsText:-pC\uffc3\ufffe\uffe0f+\uffc0\uff973\uffac\uff93\uffd2\ufffd\uffe7\uffc0\ufff6s\uffc0\uffb9\uffe9\uffeba6\ufff1\uff96\uffbe\uffff\uff83\ufffb\uffbf\ufff5\uff8f~\uffeb7\uffbf\ufffc\uff9b\uffbf\ufff8\uffe9_\ufffc\uff95\uffbf\ufff5\uffca+\uffff\uffdd\uffaf\uffa8\ufffc+\ufffc\uff96\uff99\uffbf\ufff5\uffbf~\uffe7\uffde\uffef\uffbc\uffce\uffcc\uffcf\uffff\uffec\ufff3\uffe4y\uffd6\uffd6\uffaa\uff8f\ufff4\uffdc]\uff8c'\uffe2\ufffe\ufff87wy\uffb9\uff86\uffc3\uffc0\uffaf~o\uffd1\uffb3(\ufff5\uffedMy\ufff6\uffbeK&\uffba\uffa9\uffd2\ufff3I\uffbd\uff88\6<\uff87l}NZ\uff8cw\uff91\uffb7:x\uffb7\uffaa\uff96\uffd8}\uffd1\uff85hG\ufff0\uffa8\ufff9\uffa4\uff8d\uff9e\uffb1\uffc4\uffeeW9F\uff88.\uffa3\uffaa\uffa30
segmentsText.length:170
ascent:12
descent:3
nSegments:0
lineCount:19
strlen:388
java.lang.ArrayIndexOutOfBoundsException: 215
	at org.eclipse.swt.graphics.TextLayout.computeRuns(TextLayout.java:147)
	at org.eclipse.swt.graphics.TextLayout.getBounds(TextLayout.java:929)
	at org.eclipse.swt.custom.StyledTextRenderer.calculate(StyledTextRenderer.java:212)
	at org.eclipse.swt.custom.StyledTextRenderer$1.run(StyledTextRenderer.java:242)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3527)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3174)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
segmentsText:\uffb0\uffce[\uff8b\uffdc\uffd0\uffb0\uffff\uffb8\uffd9
segmentsText.length:11
ascent:12
descent:3
nSegments:0
lineCount:3
strlen:29
java.lang.ArrayIndexOutOfBoundsException: 17


[snip]







It ends with


java.lang.ArrayIndexOutOfBoundsException
segmentsText:-I\uffb4\uffca\uffd7<]\uffd1Z\uffd0E6\uffc0>*\uffb0\uffae\uffeb\uffcblm^\uffcb\ufff3N]\uffe3\uff82^\uffaaX\uffe9Do\uffb5x\uffff\ufffb\uffbf\ufff3\uffdd\uffef\uff9c\uff99<\uff85\uffedO\uffec\uff91\uffb7F>\ufffb\uffec3\uffd30mg\uffbe\uffecQ\uffaa\uff91\ufff6>\uffb57\ufff6pl76M\uffb3\uffee\uffae\uffba\uffce\uffeeN%\uffa8\uff84B\uffa1\uff9b\uff91\uff8f\uffa5&R\uffad\uffbbb@
segmentsText.length:107
ascent:12
descent:3
nSegments:0
lineCount:12
strlen:217
java.lang.ArrayIndexOutOfBoundsException
segmentsText:-\uffb8\uffd0\uffd7\uff8d\uffa1"\uffd7\uffd1JPiz\uffa0I\uff96\uffe5\uff8e\uffff\uffe8\uffd87\uffa0\uffa8
segmentsText.length:25
ascent:12
descent:3
nSegments:0
lineCount:5
strlen:57
java.lang.ArrayIndexOutOfBoundsException
segmentsText:-\uffd83	\uffa2@ x\uffe6\uffe0\uffcb\ufffd7l\ufff1\uffdfO\uffa7\uff93}\ufffb\ufffe\uffbf\uffff\uffdb?\ufffc\uffc6p\uffe2\ufff0H\uffffY\uffbdC3\uff98\uff89\uff82\uffc8Z 	\ufffe"2\uffa9\uffeb\uffdd\uffbf\uffed88} \ufff6\uffd0\uffbf\uffff8\ufff6P	\uffbe&\uffce\uff8a\ufff3\uffdb\uffbcq\uffbd2q8\uffc0\ufff7\ufff4[\uffc8/\uff8e\uffdc\uffba\uffa3\ufff5\uffd6\uffcb<\uffabiQz\uffe5\uffe3+\ufff3\uffbcm\uffcf\uffcb\uffb9r\uffe9
segmentsText.length:125
ascent:12
descent:3
nSegments:0
lineCount:16
strlen:251
java.lang.ArrayIndexOutOfBoundsException
segmentsText:-H\uff95\uffeb;\uffc8\uff92\uffdc\uffd8\uffd8\uffe8\uffcc:'\ufffez\uffe2\uffc1>\uffd8x\uffbf=zh\uffb4\ufff5\uffb16S \uff9c;\uffc0\uff8eI\uffb3)\uff88\uffac	\uff92\uffc10s\uffea"\uffe4\uffb5Y\uff96{\uff9f\uffedRjU\ufff6x\uffff\uffbe\ufffd\uffb2$\uffab\uffaaZXI\uffdf\uff80*{y\uffcc\uff93\uffd9=r\uffb4d~UTQ\uffcclN\uffdaU\ufffe~h\uffec\uff8da\uffc3q\uff87\uffdf\uff8e5\uffc5L\uffcb\uff8c\ufffd \uffdd\uffadn]UQE\uffdfd\uffac\uffd8\uffa5\uff91yx\uffcc>4\ufff9c\uffbf}<	\uffca\uffbb
segmentsText.length:151
ascent:12
descent:3
nSegments:0
lineCount:16
strlen:289
java.lang.ArrayIndexOutOfBoundsException
segmentsText:\uff8ek\uffa2\uffcaE\uffbeC|\uffbel\uffefy\uffa2\uffab\ufff9\uffe1\ufff8w\ufffe\uffed\uff9ew\ufffe\ufffch\uffc9xc7\uff83y\uffa4w\uffdb\uff93C|a\uffbc\uff90Y!V\uffbe\uff97\uffb17\uffc6\ufff6\ufffen\uffaf\F[i\uffa1\uff87\ufffd*\uffaa\uffb8\uffb6\uffe1\uff98\uffd9\uffb6lu\uffad&K\uffb2kM\uff969z8k\uff8a\uffd9\uff8e\uff9dJ\uffa7$I
segmentsText.length:103
ascent:12
descent:3
nSegments:0
lineCount:11
strlen:199
java.lang.ArrayIndexOutOfBoundsException
segmentsText:-\uffd0Bn\uffaf\uffaeQ\uffa5\uff80D\uff81@\uff81N3\uffb4\uff94\ufff6\ufffbB\ufff8\uff91\uffdf\uffe7\uffe5D\uffd4\uffd8\ufffe\uffab\uffd7cy $\uff92\uffb8P\uff99ga\uffc5\uffaf(\uffda\uffd5\ufffee\uffe1:\ufff8\uffec\uffb7\uffd8\uff8f<_\uffb0\uffecb.\uff97\uffbfx\uffac\uff9c\uff91|\ufff9\uff983\uffcau\uff8d\ufff3i\uffeb\uffb2\uff80\uff92\uffa4T\uffb5F\uff96k\uffa4\uffa9L&}QWjUu\uff9d\uff9a\ufff3\uffbd\ufff0\uffddu\uffbdq/<\\ufffa8\uffef\uffa6\ufffb\uffe3K~f\uffdd]u\uff97>\uffbeT\uffa20\uffe6W)\uffaeU\uffa2p\uffa9\uffc6\uffe7i1K\uffe0\uffa2\uff83\uffba\uffba\uffbaK_Z\uffa2\uffd3*\uffaa\uffa8\uffa2\uff8a\uffa5\uffb0r\uff96F\uffcc\uff80@L\uffbd\uffd6U\uffff\uffe4\uffa0\ufffa\uffd3.\uffd5\uff982\uffcf\uffa5\uff84wvAQ\uffe3\uffe2W\uffd3K\uff99-\ufff8\uff92\uffce8\uffb9\uffa8\uffb0n\uff85\uff83\uffb9\uff81ZK\uffe2\uffa6\ufff3o\uff8e\uffbe\ufff9a\uffc4\uff9a\uffb1\uffe2\uffc5#\ufff7G|zp\uffabF\uffe6\uffa3\ufff5\uffd16kzr\ufff85\ufff8\uff9a\uffcf\uffb8Y;q,aZ\uffa6\uffef\uffed9'\ufffe\uff90\ufff7\uff89\uff85\uffbc\uffe6\uffdc\uff90\uff84\uff9c\uffeb\ufff3\ufffb\uffdc\uffb2\uffe7\uffee\ufffeU{N\uffb1!\uffe3\ufff7\uff86\uff8e+\uffc0\uff92{\uff88$\uff92GR@r$\uffe7\uffcd?\uffbd\ufff9\uffe3\uff9f<R\uffb0\uffee\uffd9\uffd7\uffa3\uffd4(A%\uffa8\uffd4(\uffbe
segmentsText.length:352
ascent:12
descent:3
nSegments:0
lineCount:35
strlen:730
java.lang.ArrayIndexOutOfBoundsException
segmentsText:-Wx_\uffc8p.\uff90\uffc1\uffdf\uffd0J\uff97\ufff8\uffb4\uffe8\uffa2N\uff85.\ufff6\uffe8\uffe4\uffd0b[\uffa4cq\uffcdRp\uffe9\uffe0:X\uffddth\uffabBA3L\uff87\uffe2	ZH\uffa0\uff81\uffbc\uff83\uff90\uffaf\uffc6\ufff3r\uffbfr?\uffd3|?C\uff86\uffdc{\uff977\ufff1b\uff9e\uffe7\uffee}\uff9fW6\uffa5z	\ufffd\uff9e\uff9e\uffd7\ufff3L\uff9f\ufff4\uffebG\uffadH$\uff84\uffa8\uffd5jD\uffb4\ufff2rEU$Bx\uffe6{D\uffb4\ufff7yO5\uffde\uffd9\uffdd\uffe94\uffeei\uffdc\uffaf\uffc2s\ufffc\ufff0\uffdba\ufff5{U\ufffa\uffaf\uffce\uff98\uffc7}WW&\uffac\ufffa\uffa3\uffe2\uffd9>\uff9e\uffa5\uffa7K\ufff5f}\uff8a\uffa6H\uff8dZ\ufff7\ufffb]=\uff9f\uffe2\uff97\uff823.&\uff85s\uff81\uffd0\uffa1.\ufff5<,*\uffea\uffcar\ufffdV\uffe0\ufffc\uffd9\ufff0+I\uffd5\uff9d{>\uffefy\uffb4\uff80\uffdd{\uffda\uffb1\uffd0M\uffd1\uffdf\uffc8\uff88huf\uffc1h$\uffce\uffcb6>\uffa1\uffba!e\ufffd\uffec\uffb4\uffb6\uffff\uffe5\uffbczzl\uff8a\uffd6\uff84\uffa5\uff8f\uffe9-
segmentsText.length:273
ascent:12
descent:3
nSegments:0
lineCount:30
strlen:547
java.lang.ArrayIndexOutOfBoundsException

!ENTRY org.eclipse.cdt.core 1 0 2010-05-30 21:16:33.716
!MESSAGE Indexed 'Spannung.Viktor' (338 sources, 1.177 headers) in 55,79 sec: 132.163 declarations; 342.609 references; 1 unresolved inclusions; 108 syntax errors; 15.186 unresolved names (3,10 %)
Comment 9 Felipe Heidrich CLA 2010-05-31 12:15:20 EDT
Thank you.

The problem is the text you are passing is not valid Unicode text, it contains \uFFFF and \uFFFE which are not accepted by Pango.
On my machine I get several warnings running with the text sample you provided, for example:
(SWT:23942): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()

This creates inconsistencies between the internal representation of the string (in UTF-8 for pango) and the one in Java (UCS-4).

Test case:

import org.eclipse.swt.widgets.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.internal.Converter;
import org.eclipse.swt.internal.gtk.OS;

public class PR314620 {
public static void main(String[] args) {
	final Display display = new Display();
	final String string = "\uffe1\uffc0\uffe2\uffe3j\uffca\ufff8\uffed\uff84\ufffdp\uffff\uff91{\ufffe\uffbf\ufffd\uffed\uffd5\uffe9\uff8a\uff88\uffb8g\ufff9\uff82\uffff\uffdb\uffc7V\ufffbm";
	byte[] buffer = Converter.wcsToMbcs(null, string, false);
	int context = OS.gdk_pango_context_get();
	int pangoLayout = OS.pango_layout_new(context);
	OS.pango_layout_set_text(pangoLayout, buffer, buffer.length);//validates the utf-8 string
	int ptr = OS.pango_layout_get_text(pangoLayout);
	System.out.println("Size in java " + string.length());
	System.out.println("Size in utf8 " + OS.g_utf8_strlen(ptr, -1));//each FFFF or FFFE will cause the utf8 string to be 2 chars bigger than it really is

	byte[] buffer2 = new byte[OS.strlen(ptr)];
	OS.memmove(buffer2, ptr, buffer2.length);
	int errorCount = 0;
	for (int i = 0; i < buffer.length; i++) {
		if (buffer[i] != buffer2[i]) {
			int offset = OS.g_utf8_pointer_to_offset(ptr, ptr + i) - errorCount * 2;
			
			System.out.println("Error at 0x" + Integer.toHexString(string.charAt(offset)) + " char offset: " + offset + " byte offset " + i);
			i += 2;//skip next two bytes (which FFFF FFFE is composite of 3 bytes)
			errorCount++;
		}
	}
	
	
//	char[] chars = Converter.mbcsToWcs(null, buffer);
//	String newString = new String(chars, 0, chars.length);
	
	TextLayout layout = new TextLayout(display);
	layout.setText(string);
	layout.setAscent(12);
	layout.setDescent(3);
	layout.setWidth(177);
	layout.getBounds();
	layout.dispose();
	display.dispose ();
}
}

---------------------

Not sure what to do, the only fix I can think of is replacing FFFF FFFE by another character.
Comment 10 Jens Seidel CLA 2010-06-04 04:57:27 EDT
(In reply to comment #9)
> The problem is the text you are passing is not valid Unicode text

Probably you want to tell me that the encoding of the text doesn't match the expected one. This is indeed possible. Nevertheless I strongly assume that the text I have are representable in Unicode.

> On my machine I get several warnings running with the text sample you provided,
> for example:
> (SWT:23942): Pango-WARNING **: Invalid UTF-8 string passed to
> pango_layout_set_text()

No, I have never seen any such warning (where should it occur, on the console from which I start eclipse?). Maybe it depends on the compiler flags used to compile pango (which I used in the past for own projects as well).

> This creates inconsistencies between the internal representation of the string
> (in UTF-8 for pango) and the one in Java (UCS-4).

Yep, possible. Nevertheless I do not know what text causes this kind of error. Is it a git commit message or the content of a file? I don't know.
 
I tried to decipher some \u.... texts (using http://www.macosxhints.com/article.php?story=20050208053951714 as I did not found another way) but found only garbage I could not read.

> Test case:

Should I perform any steps with it? I fail to compile it as I'm not familar with Java:
I get:

$ javac -classpath /mnt/home/jens/local.debian/share/eclipse/plugins PR314620.java
PR314620.java:1: package org.eclipse.swt.widgets does not exist
import org.eclipse.swt.widgets.*;

I have the source code of org.eclipse.swt still checked out but it doesn't contains any *.jar file and I don't know how to produce these (there is no "Build" action in Eclipse!??).
 
> Not sure what to do, the only fix I can think of is replacing FFFF FFFE by
> another character.

But you probably agree that encoding errors can occur very often, right?
Any hint where the encoding problem exists would be great ...
Comment 11 Felipe Heidrich CLA 2010-06-04 09:48:11 EDT
This is not a encoding problem (as you said, it is all unicode).

This is a bug in PangoLayout->set_text()  (see pango-layout.c)

Close to the end of this method they try to validate the text. They loop over the text in bytes (UTF8) and for each invalid byte they replace by -1 (to cause the engine to generate an unknown glyph index).

The problem is that the chars \uFFFF and \uFFFE use 3 bytes in UTF-8. It means that each \uFFFF or \uFFFE will cause 3 unknown glyph in the final text. This also cause the size of the text in chars to be bigger by 2 for each \uFFFF or \uFFFE (and that is why we are getting the expection in java).

Here is the faulty code in pango PangoLayout->set_text():
  /* validate it, and replace invalid bytes with '?'
   */
  start = layout->text;
  for (;;) {
    gboolean valid;

    valid = g_utf8_validate (start, -1, (const char **)&end);

    if (!*end)
      break;

    /* Replace invalid bytes with -1.  The -1 will be converted to
     * ((gunichar) -1) by glib, and that in turn yields a glyph value of
     * ((PangoGlyph) -1) by PANGO_GET_UNKNOWN_GLYPH(-1),
     * and that's PANGO_GLYPH_INVALID_INPUT.
     */
    if (!valid)
      *end++ = -1;

    start = end;
  }

-------------------
I believe the error is in these lines: 
    if (!valid)
      *end++ = -1;


It should have been (I think):
    if (!valid) {
      *end = -1;
      end = g_utf8_find_next_char (end, -1) 
    }

I did not test this "patch"
Comment 12 Felipe Heidrich CLA 2010-06-04 09:58:32 EDT
I entered a bug against pango:
https://bugzilla.gnome.org/show_bug.cgi?id=620572
Comment 13 Steven Tamm CLA 2010-06-30 16:13:02 EDT
I hit this issue (with the same stack trace) because I had a file that included a zero-width space '\u200B' directly in a string in the file.  Removing the zero-width space from the string fixed the problem.

I don't think this has anything to do with invalid utf8 characters

To reproduce, just have a file where you have a zero-width space in a string

public class Test {
   public static String foo = "test.\u200Bmore()";
}

Where the \u200B is directly in the file, and not encoded
Comment 14 David Plass CLA 2011-04-04 11:43:13 EDT
(In reply to comment #13)
> I hit this issue (with the same stack trace) because I had a file that included
> a zero-width space '\u200B' directly in a string in the file.  Removing the
> zero-width space from the string fixed the problem.
> 
> I don't think this has anything to do with invalid utf8 characters
> 
> To reproduce, just have a file where you have a zero-width space in a string
> 
> public class Test {
>    public static String foo = "test.\u200Bmore()";
> }
> 
> Where the \u200B is directly in the file, and not encoded

Same thing happened to me; \u200b in a file caused Eclipse to have this same exact error. 

Version: 3.6.1
Build id: M20100909-0800
Comment 15 Felipe Heidrich CLA 2011-04-04 12:12:01 EDT
The  \u200b is a different problem (than \uFFFE).
Does it happen on Eclipse M7 ?
Comment 16 Walter Harley CLA 2011-09-26 16:14:02 EDT
(In reply to comment #15)
> The  \u200b is a different problem (than \uFFFE).
> Does it happen on Eclipse M7 ?

I've entered Bug 358970 to track the \u200b problem.  I don't know if it repros on 3.7.
Comment 17 Dani Megert CLA 2011-09-30 07:25:34 EDT
See also bug 359449 which reports an AIOOB plus problems when moving the caret (e.g. revealing not working or wrong).
Comment 18 Eric Williams CLA 2018-07-06 13:49:56 EDT
I cannot reproduce this issue on SWT master as of today, Fedora 28, and GTK3.22.