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

Bug 277089

Summary: [table] IOOBE when dynamically creating columns
Product: [RT] RAP Reporter: Benjamin Muskalla <b.muskalla>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 1.2   
Target Milestone: 1.2 RC2   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
testcase
none
Proposed solution none

Description Benjamin Muskalla CLA 2009-05-20 05:12:48 EDT
When dynamically creating columns *after* the data array is initialized it happens that the array is smaller then maximal column count.
Comment 1 Benjamin Muskalla CLA 2009-05-20 05:13:12 EDT
Created attachment 136458 [details]
testcase

.
Comment 2 Benjamin Muskalla CLA 2009-05-20 05:14:54 EDT
Just for the record, here is a stack trace

java.lang.ArrayIndexOutOfBoundsException: 3
	at org.eclipse.swt.widgets.TableItem$TableItemAdapter.getCellBackgrounds(TableItem.java:52)
	at org.eclipse.swt.internal.widgets.tableitemkit.TableItemLCA.writeCellBackgrounds(TableItemLCA.java:249)
	at org.eclipse.swt.internal.widgets.tableitemkit.TableItemLCA.writeChanges(TableItemLCA.java:158)
	at org.eclipse.swt.internal.widgets.tableitemkit.TableItemLCA.access$2(TableItemLCA.java:151)
	at org.eclipse.swt.internal.widgets.tableitemkit.TableItemLCA$1.run(TableItemLCA.java:108)
	at org.eclipse.swt.internal.widgets.tableitemkit.TableItemLCA.preservingInitialized(TableItemLCA.java:472)
	at org.eclipse.swt.internal.widgets.tableitemkit.TableItemLCA.renderChanges(TableItemLCA.java:101)
	at org.eclipse.rwt.lifecycle.AbstractWidgetLCA.render(AbstractWidgetLCA.java:35)
	at org.eclipse.swt.internal.widgets.displaykit.DisplayLCA$RenderVisitor.render(DisplayLCA.java:92)
	at org.eclipse.swt.internal.widgets.displaykit.DisplayLCA$RenderVisitor.doVisit(DisplayLCA.java:76)
	at org.eclipse.swt.internal.widgets.WidgetTreeVisitor$AllWidgetTreeVisitor.visit(WidgetTreeVisitor.java:28)
Comment 3 Ralf Sternberg CLA 2009-05-20 08:38:29 EDT
Created attachment 136480 [details]
Proposed solution

The fix is to loop over the data array in getCellBackground/Foreground/Font. If the data array does not yet exit or does not have the expected length, the related elements in the target array remain null.
Comment 4 Ivan Furnadjiev CLA 2009-05-25 07:41:28 EDT
Changes are in CVS HEAD.