Community
Participate
Working Groups
HEAD This occurs only the first time the Expressions view is selected: 1. Start the IDE with in a perspective where the Expressions view is open and visible. 2. Click on an element in the expressions view in the Expression column. 3. NPE is logged The exception occurs in ColumnViewer.java:211, which seems improbable because the previous call cellEditor.setFocus() also dereferences the member that is null. I put a watchpoint on the cellEditor variable and found that the trace below resets the cellEditor to null. What happens is that when the cell gets focus, it's also the first time that a selectionChanged event is issued in the view. This causes some actions to get initialized in the view and one of these actions refreshes the view. The view refresh then resets the edit and clears the cellEditor. I'm not really sure whether the problem is in the ColumnViewer or with the view. Thread [main] (Suspended (access of field cellEditor in ColumnViewerEditor)) TreeViewerEditor(ColumnViewerEditor).cancelEditing() line: 401 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: 187 VariablesView$SelectionProviderWrapper.setActiveProvider(ISelectionProvider) line: 175 VariablesView$SelectionProviderWrapper.access$3(VariablesView$SelectionProviderWrapper, ISelectionProvider) line: 164 VariablesView$5.focusLost(FocusEvent) line: 687 TypedListener.handleEvent(Event) line: 143 EventTable.sendEvent(Event) line: 84 Tree(Widget).sendEvent(Event) line: 1258 Tree(Widget).sendEvent(int, Event, boolean) line: 1282 Tree(Widget).sendEvent(int) line: 1263 Tree(Control).sendFocusEvent(int) line: 3527 Tree(Control).gtk_event_after(int, int) line: 2896 Tree(Widget).windowProc(int, int, int) line: 1738 Tree(Control).windowProc(int, int, int) line: 4964 Tree.windowProc(int, int, int) line: 3505 Display.windowProc(int, int, int) line: 4369 OS._gtk_widget_grab_focus(int) line: not available [native method] OS.gtk_widget_grab_focus(int) line: 12780 Text(Control).forceFocus(int) line: 2304 Text(Control).forceFocus() line: 2297 Text(Control).setFocus() line: 3896 TextCellEditor.doSetFocus() line: 213 TextCellEditor(CellEditor).setFocus() line: 835 TreeViewerEditor(ColumnViewerEditor).activateCellEditor(ColumnViewerEditorActivationEvent) line: 209 TreeViewerEditor(ColumnViewerEditor).handleEditorActivationEvent(ColumnViewerEditorActivationEvent) line: 444 TreeModelViewer(ColumnViewer).triggerEditorActivationEvent(ColumnViewerEditorActivationEvent) line: 680 TreeModelViewer(ColumnViewer).handleMouseDown(MouseEvent) line: 664 ColumnViewer.access$0(ColumnViewer, MouseEvent) line: 660 ColumnViewer$1.mouseDown(MouseEvent) line: 89 TypedListener.handleEvent(Event) line: 191 EventTable.sendEvent(Event) line: 84 Tree(Widget).sendEvent(Event) line: 1258 Display.runDeferredEvents() line: 3549 Display.readAndDispatch() line: 3170 Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2697 Workbench.runUI() line: 2661 Workbench.access$4(Workbench) line: 2495 Workbench$7.run() line: 674 Realm.runWithDefault(Realm, Runnable) line: 332 Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 667 PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149 IDEApplication.start(IApplicationContext) line: 115 EclipseAppHandle.run(Object) line: 196 EclipseAppLauncher.runApplication(Object) line: 110 EclipseAppLauncher.start(Object) line: 79 EclipseStarter.run(Object) line: 344 EclipseStarter.run(String[], Runnable) line: 179 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43 Method.invoke(Object, Object...) line: 616 Main.invokeFramework(String[], URL[]) line: 622 Main.basicRun(String[]) line: 577 Main.run(String[]) line: 1410 Main.main(String[]) line: 1386
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.