Bug 200558 - [Viewers] ArrayIndexOutOfBoundsException in ColumnViewer
Summary: [Viewers] ArrayIndexOutOfBoundsException in ColumnViewer
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3.1   Edit
Assignee: Thomas Schindl CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-20 10:18 EDT by Andrzej Cichocki CLA
Modified: 2007-09-17 17:55 EDT (History)
4 users (show)

See Also:
eclipse: review+


Attachments
RCP application that demonstrates the problem (72.07 KB, application/x-zip)
2007-08-20 10:18 EDT, Andrzej Cichocki CLA
no flags Details
Fix (1.57 KB, patch)
2007-08-20 13:55 EDT, Thomas Schindl CLA
no flags Details | Diff
Patch without needless DisposeEvent (3.10 KB, patch)
2007-08-21 14:41 EDT, Thomas Schindl CLA
no flags Details | Diff
mylyn/context/zip (2.43 KB, application/octet-stream)
2007-08-21 14:41 EDT, Thomas Schindl CLA
no flags Details
Patch with Test-Case (7.62 KB, patch)
2007-08-21 15:01 EDT, Thomas Schindl CLA
no flags Details | Diff
mylyn/context/zip (4.66 KB, application/octet-stream)
2007-08-21 15:01 EDT, Thomas Schindl CLA
no flags Details
More fixes (21.65 KB, patch)
2007-08-23 17:03 EDT, Thomas Schindl CLA
no flags Details | Diff
mylyn/context/zip (6.13 KB, application/octet-stream)
2007-08-23 17:03 EDT, Thomas Schindl CLA
no flags Details
Patcht (3.23 KB, patch)
2007-09-06 13:30 EDT, Thomas Schindl CLA
no flags Details | Diff
Patch for 3.3.1 (5.94 KB, patch)
2007-09-07 11:40 EDT, Thomas Schindl CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrzej Cichocki CLA 2007-08-20 10:18:47 EDT
Created attachment 76448 [details]
RCP application that demonstrates the problem

Build ID: I20070621-1340

Steps To Reproduce:
1. Run the attached RCP app
2. Click the only button

An editor and error log should appear.

3. Click on 'item' in the editor

The following exception appears in the log:

java.lang.ArrayIndexOutOfBoundsException: 1
at org.eclipse.jface.viewers.ColumnViewer$2.canEdit(ColumnViewer.java:236)
at org.eclipse.jface.viewers.ColumnViewerEditor.activateCellEditor(ColumnViewerEditor.java:147)
at org.eclipse.jface.viewers.ColumnViewerEditor.handleEditorActivationEvent(ColumnViewerEditor.java:367)
at org.eclipse.jface.viewers.ColumnViewer.triggerEditorActivationEvent(ColumnViewer.java:637)
at org.eclipse.jface.viewers.ColumnViewer.handleMouseDown(ColumnViewer.java:621)
at org.eclipse.jface.viewers.ColumnViewer.access$0(ColumnViewer.java:617)
at org.eclipse.jface.viewers.ColumnViewer$1.mouseDown(ColumnViewer.java:108)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:178)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at columnviewer.Application.start(Application.java:14)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:504)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443)
at org.eclipse.equinox.launcher.Main.run(Main.java:1169)
at org.eclipse.equinox.launcher.Main.main(Main.java:1144)


More information:
The issue here is that the ColumnViewer's EditingSupport has a fixed columnIndex, which becomes wrong if a preceding column is disposed.
Comment 1 Thomas Schindl CLA 2007-08-20 13:55:28 EDT
Created attachment 76472 [details]
Fix

We need to clear all legacy editing supports
Comment 2 Thomas Schindl CLA 2007-08-21 13:56:48 EDT
Is this a 3.3.1 candidate?
Comment 3 Thomas Schindl CLA 2007-08-21 14:41:01 EDT
Created attachment 76572 [details]
Patch without needless DisposeEvent
Comment 4 Thomas Schindl CLA 2007-08-21 14:41:03 EDT
Created attachment 76573 [details]
mylyn/context/zip
Comment 5 Thomas Schindl CLA 2007-08-21 15:01:02 EDT
Created attachment 76574 [details]
Patch with Test-Case
Comment 6 Thomas Schindl CLA 2007-08-21 15:01:04 EDT
Created attachment 76575 [details]
mylyn/context/zip
Comment 7 Thomas Schindl CLA 2007-08-23 17:03:40 EDT
Created attachment 76817 [details]
More fixes

=> Fix against AIOB-Exceptions
=> Added check-method that only Legacy-Support-Instances are cleared
Comment 8 Thomas Schindl CLA 2007-08-23 17:03:42 EDT
Created attachment 76818 [details]
mylyn/context/zip
Comment 9 Kim Horne CLA 2007-08-31 09:08:26 EDT
+1 for 3.3.1 (and HEAD)
Comment 10 Thomas Schindl CLA 2007-08-31 09:36:57 EDT
Released to R3_3_maintenance >= 20070831
Comment 11 Thomas Schindl CLA 2007-08-31 09:39:42 EDT
Integration for 3.4 is done in bug #201905
Comment 12 Thomas Schindl CLA 2007-08-31 13:38:17 EDT
Sideeffects in complete Suite:
- Widget Diposed on WinXP
- NPE on OS-X
Comment 13 Thomas Schindl CLA 2007-08-31 14:11:58 EDT
Ok. Current state CVS 3_3_maint-state is that we fixed the ArrayIndexOutOfBoundsException. The real fix (clearing the editors) to the problem produced failing tests.

Removing target for now because we might (very likely) miss 3.3.1 cut off
Comment 14 Thomas Schindl CLA 2007-09-06 10:18:42 EDT
What would be if we would recreate the editor every time when we are in legacy mode?
Comment 15 Thomas Schindl CLA 2007-09-06 13:30:48 EDT
Created attachment 77833 [details]
Patcht

This way tests on WinXP passes
Comment 16 Thomas Schindl CLA 2007-09-06 14:50:22 EDT
And the OS-X seems to be green too (well the suite is not green but the failing tests can have nothing to do with the change with the patch)
Comment 17 Thomas Schindl CLA 2007-09-07 11:40:58 EDT
Created attachment 77891 [details]
Patch for 3.3.1
Comment 18 Boris Bokowski CLA 2007-09-07 11:47:12 EDT
The patch looks good, so +1 from me for 3.3.1 but we would need a separate bugzilla for it, and we should run the test suite on Windows, GTK, and the Mac to make sure there are no surprises. :)
Comment 19 Boris Bokowski CLA 2007-09-07 11:51:22 EDT
Right, this is the bug for 3.3.1. Sorry for causing confusion.
Comment 20 Thomas Schindl CLA 2007-09-07 11:57:37 EDT
Released to 3_3_1_maint >= 20070907
Comment 21 Thomas Schindl CLA 2007-09-07 11:57:54 EDT
... and marking fixed
Comment 22 Tod Creasey CLA 2007-09-07 13:04:46 EDT
+1 from me but this methods need comments - it is not at all clear why this is being done just from the code.
Comment 23 Thomas Schindl CLA 2007-09-07 13:18:14 EDT
(In reply to comment #22)
> +1 from me but this methods need comments - it is not at all clear why this is
> being done just from the code.
> 

/**
 * Clear all cell-editors setup for backwards compatibility in
 * {@link #setupEditingSupport(int, ViewerColumn)}. This has to be done
 * whenever a column is disposed because the index cached when the anonymous
 * class is created has to be readjusted
 */

?
Comment 24 Tod Creasey CLA 2007-09-07 15:34:32 EDT
That looks fine Tom.
Comment 25 Thomas Schindl CLA 2007-09-07 15:46:25 EDT
added comment in CVS
Comment 26 Tod Creasey CLA 2007-09-11 14:12:46 EDT
Bug200558 test had an unused private class that I deleted as it was generating build warnings.
Comment 27 Thomas Schindl CLA 2007-09-17 17:55:53 EDT
- Verified in M20070913-1500
- Integration in CVS-HEAD is done in bug #201905