| Summary: | [Viewers] NPE when activating cell editor in ColumnViewer in ExpressionsView | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Pawel Piech <pawel.1.piech> |
| Component: | UI | Assignee: | Platform UI Triaged <platform-ui-triaged> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | chanskw, magdalena+eclipse, marc.khouzam, prakash, psuzzi, qlwangbj, salvatore.culcasi, vasili.gulevich |
| Version: | 3.7 | Keywords: | helpwanted |
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | stalebug | ||
|
Description
Pawel Piech
I'm unable reproduce this. Is this on HEAD? ColumnViewer:211 doesn't have any statements at all and the last edit in that file is 2 yrs back (http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.jface/src/org/eclipse/jface/viewers/ColumnViewer.java?view=markup) Can we have the stacktrace of the actual NPE? (In reply to comment #1) > Can we have the stacktrace of the actual NPE? My bad, it's ColumnViewerEditor.java. The full trace is: java.lang.NullPointerException at org.eclipse.jface.viewers.ColumnViewerEditor.activateCellEditor(ColumnViewerEditor.java:211) at org.eclipse.jface.viewers.ColumnViewerEditor.handleEditorActivationEvent(ColumnViewerEditor.java:444) at org.eclipse.jface.viewers.ColumnViewer.triggerEditorActivationEvent(ColumnViewer.java:680) at org.eclipse.jface.viewers.ColumnViewer.handleMouseDown(ColumnViewer.java:664) at org.eclipse.jface.viewers.ColumnViewer.access$0(ColumnViewer.java:660) at org.eclipse.jface.viewers.ColumnViewer$1.mouseDown(ColumnViewer.java:89) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:191) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3549) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3170) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2697) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2661) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2495) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577) at org.eclipse.equinox.launcher.Main.run(Main.java:1410) at org.eclipse.equinox.launcher.Main.main(Main.java:1386) java.lang.NullPointerException at org.eclipse.jface.viewers.ColumnViewerEditor.activateCellEditor(ColumnViewerEditor.java:211) Is this on HEAD? 211 is empty line. Even the previous versions, if the cellEditor is null on that line, NPE should have been thrown on the earlier statement itself. Can you double check the version you are using? HEAD: http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.jface/src/org/eclipse/jface/viewers/ColumnViewerEditor.java?view=markup Rev 1.33: http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.jface/src/org/eclipse/jface/viewers/ColumnViewerEditor.java?revision=1.33&view=markup Rev 1.32: http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.jface/src/org/eclipse/jface/viewers/ColumnViewerEditor.java?revision=1.32&view=markup (In reply to comment #3) > Is this on HEAD? It was before revision 1.34 from yesterday ;-) > Even the previous versions, if the cellEditor is null on > that line, NPE should have been thrown on the earlier statement itself. That's what I thought! But if you look at the first stack trace in this bug, you'll see that ColumnViewerEditor.cancelEditing() is being called (through a number of listeners) as a result of the cellEditor.setFocus() call. I don't really know if the listeners are doing something illegal, or if the ColumnViewerEditor.activateCellEditor() should guard for the fact that it's calling out to unknown listeners in the setFocus() call. I'm getting the same exception (for a while now). The version is from org.eclipse.jface_3.7.0.I20110309-1300.jar java.lang.NullPointerException at org.eclipse.jface.viewers.ColumnViewerEditor.activateCellEditor(ColumnViewerEditor.java:211) at org.eclipse.jface.viewers.ColumnViewerEditor.handleEditorActivationEvent(ColumnViewerEditor.java:444) at org.eclipse.jface.viewers.ColumnViewer.triggerEditorActivationEvent(ColumnViewer.java:680) at org.eclipse.jface.viewers.ColumnViewer.handleMouseDown(ColumnViewer.java:664) at org.eclipse.jface.viewers.ColumnViewer.access$0(ColumnViewer.java:660) at org.eclipse.jface.viewers.ColumnViewer$1.mouseDown(ColumnViewer.java:89) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:191) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3568) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3189) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577) at org.eclipse.equinox.launcher.Main.run(Main.java:1410) at org.eclipse.equinox.launcher.Main.main(Main.java:1386) I am getting the same error using Helios SR2 The existing cellEditor variable is assigned to null as consequence of the call cellEditor.setFocus(); (org.eclipse.jface.viewers.ColumnViewerEditor line 209) Here it is the stack that assigns to null the cellEditor Variable The top of the stack is where the assignment to null is done, the bottom is the call to setFocus executed on the CellEditor object Thread [main] (Suspended (modification of field cellEditor in ColumnViewerEditor)) TreeViewerEditor(ColumnViewerEditor).cancelEditing() line: 417 TreeModelViewer(ColumnViewer).cancelEditing() line: 400 TreeModelViewer(ColumnViewer).refresh(Object) line: 534 TreeModelViewer(StructuredViewer).refresh() line: 1444 TreeModelViewer(StructuredViewer).addFilter(ViewerFilter) line: 582 ShowNullArrayEntriesAction(ViewFilterAction).run(IAction) line: 102 ShowNullArrayEntriesAction(ViewFilterAction).init(IViewPart) line: 63 ViewPluginAction.initDelegate() line: 59 ViewPluginAction(PluginAction).createDelegate() line: 125 ViewPluginAction(PluginAction).selectionChanged(ISelection) line: 275 ViewPluginAction(PluginAction).selectionChanged(SelectionChangedEvent) line: 289 VariablesView$SelectionProviderWrapper.fireSelectionChanged(SelectionChangedEvent) line: 184 VariablesView$SelectionProviderWrapper.setActiveProvider(ISelectionProvider) line: 172 VariablesView$SelectionProviderWrapper.access$3(VariablesView$SelectionProviderWrapper, ISelectionProvider) line: 161 VariablesView$4.focusLost(FocusEvent) line: 702 TypedListener.handleEvent(Event) line: 143 EventTable.sendEvent(Event) line: 84 Tree(Widget).sendEvent(Event) line: 1053 Tree(Widget).sendEvent(int, Event, boolean) line: 1077 Tree(Widget).sendEvent(int) line: 1058 Tree(Control).sendFocusEvent(int) line: 2618 Tree(Widget).wmKillFocus(int, int, int) line: 1920 Tree(Control).WM_KILLFOCUS(int, int) line: 4506 Tree.WM_KILLFOCUS(int, int) line: 6177 Tree(Control).windowProc(int, int, int, int) line: 4195 Tree.windowProc(int, int, int, int) line: 5844 Display.windowProc(int, int, int, int) line: 4886 OS.SetFocus(int) line: not available [native method] Text(Control).forceFocus() line: 995 Text(Control).setFocus() line: 3000 TextCellEditor.doSetFocus() line: 213 TextCellEditor(CellEditor).setFocus() line: 833 TreeViewerEditor(ColumnViewerEditor).activateCellEditor(ColumnViewerEditorActivationEvent) line: 209 I am encoutering the same issue on org.eclipse.jface_3.6.1.M20100825-0800.jar:
Reproduce steps: Add one ComboBox after editing another ComboBox.
In ColumnViewerEditor.java:
On line 209, the setFocus is called. This call will trigger cancelEditing in which the instance of cellEditor is set to null on line 417. Then when the line of 211 is trying to use cellEditor, NPE was thrown out.
private boolean activateCellEditor(final ColumnViewerEditorActivationEvent activationEvent) {
......
1. cellEditor.setFocus(); (line 209)
3. if (cellEditor.dependsOnExternalFocusListener()) { //(line 211) NPE thrown out here...
......
}
void cancelEditing() {
......
2. this.cellEditor = null; (line 417)
......
}
Details:
Caused by: java.lang.NullPointerException
at org.eclipse.jface.viewers.ColumnViewerEditor.activateCellEditor(ColumnViewerEditor.java:211)
at org.eclipse.jface.viewers.ColumnViewerEditor.handleEditorActivationEvent(ColumnViewerEditor.java:444)
at org.eclipse.jface.viewers.ColumnViewer.triggerEditorActivationEvent(ColumnViewer.java:680)
at com.fnfr.svt.ui.common.viewers.annotatedtree.AnnotatedTreeViewer.triggerEditorActivationEvent(AnnotatedTreeViewer.java:459)
at org.eclipse.jface.viewers.ColumnViewer.editElement(ColumnViewer.java:438)
at org.eclipse.jface.viewers.TreeViewer.editElement(TreeViewer.java:1163)
at com.fnfr.svt.ui.common.viewers.annotatedtree.AnnotatedTreeViewer.putCellInEditMode(AnnotatedTreeViewer.java:553)
at com.fnfr.svt.editors.testcase.actions.steps.BaseStepsTreeAction.putCellInEditMode(BaseStepsTreeAction.java:297)
at com.fnfr.svt.editors.testcase.actions.steps.InsertStepAction$Operation.doit(InsertStepAction.java:229)
at com.fnfr.svt.editors.testcase.actions.steps.InsertStepAction$Operation.execute(InsertStepAction.java:187)
at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:511)
... 33 more
Workaround: use setFocus() on a parent control before calling org.eclipse.jface.viewers.TreeViewer.editElement(Object, int). This prevents additional activation of editors/views while cell editor is open. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |