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

Bug 251829

Summary: [table] IAE (Index out of bounds) after selecting rows in virtual TableViewer
Product: [RT] RAP Reporter: Stefan Röck <stefan.roeck>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: P3    
Version: 1.1   
Target Milestone: 1.2 M5   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 256889    
Bug Blocks:    
Attachments:
Description Flags
Snippet to reproduce this bug none

Description Stefan Röck CLA 2008-10-23 07:40:11 EDT
Tested with Firefox 3.0.3.

- Load the attached snippet
- Press last button "Select all elements" (sometimes needs two clicks)

The button's selection listener first calls table.selectAll(); and then loads the current selection of the TableViewer via tableViewer.getSelection();

--> Exception:
java.lang.IllegalArgumentException: Index out of bounds
	at org.eclipse.swt.SWT.error(SWT.java:1963)
	at org.eclipse.swt.SWT.error(SWT.java:1897)
	at org.eclipse.swt.SWT.error(SWT.java:1868)
	at org.eclipse.swt.widgets.Table.getItem(Table.java:624)
	at org.eclipse.jface.viewers.TableViewer.doGetItem(TableViewer.java:209)
	at org.eclipse.jface.viewers.AbstractTableViewer.getVirtualSelection(AbstractTableViewer.java:489)
	at org.eclipse.jface.viewers.AbstractTableViewer.getSelectionFromWidget(AbstractTableViewer.java:459)
	at org.eclipse.jface.viewers.StructuredViewer.getSelection(StructuredViewer.java:954)
	at de.cas.teamcrm.tabletest.VirtualTableTest$5.widgetSelected(VirtualTableTest.java:175)
	at org.eclipse.swt.events.SelectionEvent.dispatchToObserver(SelectionEvent.java:174)
	at org.eclipse.rwt.internal.events.Event.processEvent(Event.java:44)
	at org.eclipse.swt.events.TypedEvent.processEvent(TypedEvent.java:115)
	at org.eclipse.swt.events.TypedEvent.executeNext(TypedEvent.java:155)
	at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.readAndDispatch(RWTLifeCycle.java:241)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:682)
	at de.cas.teamcrm.tabletest.VirtualTableTest.runTableTest(VirtualTableTest.java:257)
	at de.cas.teamcrm.tabletest.VirtualTableTest.createUI(VirtualTableTest.java:290)
	at org.eclipse.rwt.internal.lifecycle.EntryPointManager.createUI(EntryPointManager.java:92)
	at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:228)
	at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:116)
	at java.lang.Thread.run(Thread.java:595)
Comment 1 Stefan Röck CLA 2008-10-23 07:40:56 EDT
Created attachment 115913 [details]
Snippet to reproduce this bug
Comment 2 Rüdiger Herrmann CLA 2008-11-27 05:07:12 EST
The content provider reduces the number if items while in updateElement().
The code in AbstractTableViewer#getVirtualSelection() seems not to be prepared for this.
Can you confirm that this works in RCP?
Comment 3 Stefan Röck CLA 2008-11-28 06:41:55 EST
This doesn't work in RCP (testet with 3.3 and 3.4) either. Would you consider this to be a bug, anyway?
Comment 4 Rüdiger Herrmann CLA 2008-11-28 07:31:53 EST
It is rather a question whether the platform team would consider this a bug;) I would go ahead and file a bug against Platform/UI and see what they say.
If you do so, please re-open with a reference to the related platform bug entry.
Comment 5 Stefan Röck CLA 2008-11-28 07:52:15 EST
filed platform bug 256889
Comment 6 Rüdiger Herrmann CLA 2009-01-22 03:39:44 EST
Applied the "fix" patch as attached to bug #256889.