| Summary: | [Table] Creating and disposing a TableColumn (without updating the TableItems) results in an ArrayIndexOutOfBoundsException | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Istvan Ballok <Istvan.Ballok> | ||||
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | Istvan.Ballok | ||||
| Version: | 1.3 | ||||||
| Target Milestone: | 1.4 M2 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Fixed in CVS HEAD. Test case added. |
Created attachment 177033 [details] an RWT code snippet to reproduce the problem Creating and disposing a TableColumn results in an ArrayIndexOutOfBoundsException, if all the items of the Table were not updated after creating the column by e.g. calling TableItem#setText(int, string) Although it could be disputed, how meaningful this is - this problem is the gist of a bug that we had in our application; However, the AIOOB exception at runtime is certainly not the expected behaviour. Please find the attached snippet to reproduce the problem. Hint: When disposing the column, the column is destroyed in the table (see Table#destroyColumn(TableColumn)) that removes the corresponding cell data from the table items (see TableItem#removeData(int)). The problem is that the TableItem#data Data[] array's length was not adjusted when the column was created and hence the precondition of the #removeData method is not met: the data array does not contain the index-th element that is to be removed. Note: the TableItem#data array's length is adjusted e.g. in TableItem#setText(int, String) by calling TableItem#ensureData(int, int). In accordance with that, this problem happens only if e.g. TableItem#setText(int, string) is not called on all the TableItems in the Table after the new column was created and before it is disposed. Note: SWT on win32 does not have any problems with this snippet.