Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 321119

Summary: tooltips on tables can destroy the session
Product: [RT] RAP Reporter: Markus Knauer <mknauer>
Component: JFaceAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: andre.weber
Version: 1.3   
Target Milestone: 1.4 M1   
Hardware: PC   
OS: other   
Whiteboard: sr131
Attachments:
Description Flags
demo project with test code
none
Workaround none

Description Markus Knauer CLA 2010-07-28 08:54:31 EDT
If s.o. changes/removes the input of a table viewer on a table with tooltips enabled it is possible and very likely that the session crashes with a 


HTTP ERROR 500

Problem accessing /view. Reason:

    Index out of bounds

Caused by:

java.lang.IllegalArgumentException: Index out of bounds
	at org.eclipse.swt.SWT.error(SWT.java:3185)
	at org.eclipse.swt.SWT.error(SWT.java:3119)
	at org.eclipse.swt.SWT.error(SWT.java:3090)
	at org.eclipse.swt.widgets.Table.getItem(Table.java:669)
	at org.eclipse.jface.viewers.CellToolTipProvider.getToolTipText(CellToolTipProvider.java:42)
	at org.eclipse.swt.internal.widgets.tablekit.TableLCA.readCellToolTipTextRequested(TableLCA.java:321)
	at org.eclipse.swt.internal.widgets.tablekit.TableLCA.readData(TableLCA.java:113)
	at org.eclipse.swt.internal.widgets.displaykit.DisplayLCA$1.doVisit(DisplayLCA.java:321)
	at org.eclipse.swt.internal.widgets.WidgetTreeVisitor$AllWidgetTreeVisitor.visit(WidgetTreeVisitor.java:35)
	at org.eclipse.swt.internal.widgets.WidgetTreeVisitor.accept(WidgetTreeVisitor.java:49)
	at org.eclipse.swt.internal.widgets.WidgetTreeVisitor.accept(WidgetTreeVisitor.java:56)
	at org.eclipse.swt.internal.widgets.WidgetTreeVisitor.accept(WidgetTreeVisitor.java:56)
	at org.eclipse.swt.internal.widgets.WidgetTreeVisitor.accept(WidgetTreeVisitor.java:56)
	at org.eclipse.swt.internal.widgets.WidgetTreeVisitor.accept(WidgetTreeVisitor.java:56)
	at org.eclipse.swt.internal.widgets.WidgetTreeVisitor.accept(WidgetTreeVisitor.java:56)
	at org.eclipse.swt.internal.widgets.displaykit.DisplayLCA.readData(DisplayLCA.java:328)
	at org.eclipse.rwt.internal.lifecycle.ReadData.execute(ReadData.java:26)
	at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.continueLifeCycle(RWTLifeCycle.java:222)
	at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.sleep(RWTLifeCycle.java:300)
	at org.eclipse.swt.widgets.Display.sleep(Display.java:1128)
	at org.eclipse.ui.application.WorkbenchAdvisor.eventLoopIdle(WorkbenchAdvisor.java:361)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2391)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2351)
	at org.eclipse.ui.internal.Workbench.access$5(Workbench.java:2206)
	at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:424)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.jface.internal.databinding.realmadapter.RealmAdapter.run(RealmAdapter.java:44)
	at org.eclipse.rap.ui.internal.RealmAdapterHook.runWithDefault(RealmAdapterHook.java:48)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:427)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:157)
	at org.eclipse.rap.tooltipbug.TBApplication.createUI(TBApplication.java:17)
	at org.eclipse.rwt.internal.lifecycle.EntryPointManager.createUI(EntryPointManager.java:92)
	at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:244)
	at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:113)
	at java.lang.Thread.run(Thread.java:619)
	at org.eclipse.rwt.internal.lifecycle.UIThread.run(UIThread.java:102)
Comment 1 Markus Knauer CLA 2010-07-28 09:01:43 EDT
Created attachment 175398 [details]
demo project with test code

The attached demo project contains some lines of code that create a table with tooltips enabled. If you move the mouse over the cells you will see some tooltips.

If you click/select a cell below 'three' the expected behaviour is that the old entries are removed and the table is filled with the new content containing only two elements.

But most of the time (it's a timing issue, so you cannot see the error *every* time) this selection event will change the content of the table and *then* a request for a tooltip on a non-existing table cell is triggered.
Comment 2 Markus Knauer CLA 2010-07-28 09:12:09 EDT
Created attachment 175399 [details]
Workaround

This is a workaround that checks that the itemIndex of the requested tooltip is within the table, but I would prefer a solution earlier in the execution flow.
Comment 3 Benjamin Muskalla CLA 2010-07-30 06:25:48 EDT
*** Bug 321300 has been marked as a duplicate of this bug. ***
Comment 4 Ralf Sternberg CLA 2010-08-02 08:54:54 EDT
Fixed in CVS HEAD and 1.3 service branch.
The TableLCA does not call CellToolTipProvider#getToolTipText for invalid cells anymore.
Comment 5 Ralf Sternberg CLA 2010-08-02 08:55:30 EDT
-> RESOLVED