Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 332925 - [DataBinding] Set input on TableViewer causes NPE while editing
Summary: [DataBinding] Set input on TableViewer causes NPE while editing
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.1   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks: 357568
  Show dependency tree
 
Reported: 2010-12-20 04:09 EST by Thomas Kratz CLA
Modified: 2019-11-05 11:38 EST (History)
1 user (show)

See Also:


Attachments
Patch on snippet to test replacing input (1.92 KB, patch)
2011-09-20 00:22 EDT, Matthew Hall CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Kratz CLA 2010-12-20 04:09:51 EST
Build Identifier: 3.7M4

I don't know if this is a bug, but I found it a little strange. In this example stacktrace I need to rebind on save of the editor and it happens when users presses CTRL+S while editing. I worked around by .cancelEditing before setting the input. This example Stacktrace is generated on 4.1

java.lang.NullPointerException
	at org.eclipse.core.databinding.ValueBinding.doUpdate(ValueBinding.java:151)
	at org.eclipse.core.databinding.ValueBinding.updateTargetToModel(ValueBinding.java:112)
	at org.eclipse.jface.databinding.viewers.ObservableValueEditingSupport.saveCellEditorValue(ObservableValueEditingSupport.java:220)
	at org.eclipse.jface.viewers.ColumnViewerEditor.saveEditorValue(ColumnViewerEditor.java:455)
	at org.eclipse.jface.viewers.ColumnViewerEditor.applyEditorValue(ColumnViewerEditor.java:311)
	at org.eclipse.jface.viewers.ColumnViewer.applyEditorValue(ColumnViewer.java:411)
	at org.eclipse.jface.viewers.AbstractTableViewer.internalRefresh(AbstractTableViewer.java:646)
	at org.eclipse.jface.viewers.AbstractTableViewer.internalRefresh(AbstractTableViewer.java:636)
	at org.eclipse.jface.viewers.AbstractTableViewer$2.run(AbstractTableViewer.java:592)
	at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1422)
	at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1383)
	at org.eclipse.jface.viewers.AbstractTableViewer.inputChanged(AbstractTableViewer.java:590)
	at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:280)
	at org.eclipse.jface.viewers.StructuredViewer.setInput(StructuredViewer.java:1669)
	at de.eiswind.paris.client.ui.book.BookCategoriesPage.initDataBindings(BookCategoriesPage.java:234)
	at de.eiswind.paris.client.ui.book.BookCategoriesPage.rebind(BookCategoriesPage.java:100)
	at de.eiswind.paris.client.ui.book.BookEditor.rebind(BookEditor.java:236)
	at de.eiswind.paris.client.ui.book.BookEditor.saveHelper(BookEditor.java:224)
	at de.eiswind.paris.client.ui.book.BookEditor.doSave(BookEditor.java:192)
	at org.eclipse.ui.internal.SaveableHelper$2.run(SaveableHelper.java:151)
	at org.eclipse.ui.internal.SaveableHelper$5.run(SaveableHelper.java:274)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
	at org.eclipse.ui.internal.WorkbenchWindow$8.run(WorkbenchWindow.java:1527)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:1524)
	at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:282)
	at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:261)
	at org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelper.java:156)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.doSave(CompatibilityPart.java:247)
	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.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:52)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:226)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:232)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:196)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:86)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.savePart(PartServiceImpl.java:1032)
	at org.eclipse.ui.internal.WorkbenchPage.saveSaveable(WorkbenchPage.java:2552)
	at org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPage.java:2570)
	at org.eclipse.ui.internal.SaveAction.run(SaveAction.java:76)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
	at org.eclipse.jface.commands.ActionHandler.execute(ActionHandler.java:121)
	at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:58)
	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.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:52)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:226)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:207)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:123)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:122)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:266)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:465)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:515)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:348)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.access$0(KeyBindingDispatcher.java:294)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:76)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1254)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1103)
	at org.eclipse.swt.widgets.Text.sendKeyEvent(Text.java:1454)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1099)
	at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1508)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4273)
	at org.eclipse.swt.widgets.Text.WM_CHAR(Text.java:2252)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4165)
	at org.eclipse.swt.widgets.Text.windowProc(Text.java:2247)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4891)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2465)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3673)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$6.run(PartRenderingEngine.java:808)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:724)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:89)
	at org.eclipse.ui.internal.Workbench$3.run(Workbench.java:534)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:516)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at de.eiswind.paris.client.core.Application.start(Application.java:35)
	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:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	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: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)

Reproducible: Always

Steps to Reproduce:
1. Create a TableViewer with Observable Content Provider
2. Create an Inline TextCellEditor with Databinding
3. Edit the Cell
4. Set a new Input while editing is ongoing
Comment 1 Matthew Hall CLA 2011-09-19 02:50:10 EDT
The stack trace seems to indicate that the source observable (observing the cell editor control) is being disposed. Widget observables dispose themselves when the source widget is disposed, so that might be the problem somehow.

I'll try to reproduce with one of a cell editor example snippet and get back to you.
Comment 2 Matthew Hall CLA 2011-09-20 00:22:53 EDT
Created attachment 203635 [details]
Patch on snippet to test replacing input

I tried to duplicate this behavior with this patch, but could not get the same exception.

Thomas, are you still able to duplicate this problem in Eclipse Indigo?
Comment 3 Thomas Kratz CLA 2011-09-20 02:52:52 EDT
Yes I still see that, last case I saw something similar was when I tried to remove an entry from the input while editing. It happens only when the editor is active. Maybe its a ComboBoxEditor?
Comment 4 Matthew Hall CLA 2011-09-20 09:40:04 EDT
Can you modify the attached patch to demonstrate the error? I'd like to help you, but I'm not sure where the problem lies.
Comment 5 Eclipse Genie CLA 2019-11-05 11:38:19 EST
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.

If you have further information on the current state of the bug, please add it. 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.