Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 501836

Summary: NPE on direct-edit in a table if the "Semantic" table is visible
Product: [Modeling] Sirius Reporter: Pierre-Charles David <pierre-charles.david>
Component: PropertiesAssignee: Pierre-Charles David <pierre-charles.david>
Status: CLOSED FIXED QA Contact: Julien Dupont <julien.dupont>
Severity: major    
Priority: P3 CC: julien.dupont
Version: 4.0.0Keywords: triaged
Target Milestone: 4.1.0   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/82464
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=bef9f99f48af61c8a1ce5a5435fc98a9593886db
Whiteboard: needtest
Attachments:
Description Flags
Video illustrating the bug none

Description Pierre-Charles David CLA 2016-09-20 08:58:41 EDT
Created attachment 264284 [details]
Video illustrating the bug

I'm putting this in the "Properties" tab because it seems to happen only when using oes.ui.properties.

Steps to reproduce (see also the attached video):
1. Open a Sirius table which supports direct edit on its elements.
2. Make sure the Properties view is visible, and the legacy "Semantic" tab is selected.
3. Edit some element in the table: NPE

java.lang.NullPointerException
	at org.eclipse.sirius.table.ui.tools.internal.properties.section.common.AbstractDTablePropertySection.update(AbstractDTablePropertySection.java:294)
	at org.eclipse.sirius.table.ui.tools.internal.properties.section.common.AbstractDTablePropertySection$1.handleNotification(AbstractDTablePropertySection.java:91)
	at org.eclipse.emf.transaction.DemultiplexingListener.resourceSetChanged(DemultiplexingListener.java:54)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl$1.run(TransactionalEditingDomainImpl.java:781)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive(TransactionalEditingDomainImpl.java:328)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.postcommit(TransactionalEditingDomainImpl.java:771)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.deactivate(TransactionalEditingDomainImpl.java:543)
	at org.eclipse.emf.transaction.impl.TransactionImpl.close(TransactionImpl.java:712)
	at org.eclipse.emf.transaction.impl.TransactionImpl.commit(TransactionImpl.java:474)
	at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:155)
	at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:488)
	at org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl.doExecute(WorkspaceCommandStackImpl.java:208)
	at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165)
	at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:219)
	at org.eclipse.sirius.table.ui.tools.internal.editor.provider.DFeatureColumnEditingSupport.standardSetValue(DFeatureColumnEditingSupport.java:301)
	at org.eclipse.sirius.table.ui.tools.internal.editor.provider.DFeatureColumnEditingSupport.setValue(DFeatureColumnEditingSupport.java:281)
	at org.eclipse.jface.viewers.EditingSupport.saveCellEditorValue(EditingSupport.java:113)
	at org.eclipse.jface.viewers.ColumnViewerEditor.saveEditorValue(ColumnViewerEditor.java:453)
	at org.eclipse.jface.viewers.ColumnViewerEditor.applyEditorValue(ColumnViewerEditor.java:309)
	at org.eclipse.jface.viewers.ColumnViewerEditor$1.applyEditorValue(ColumnViewerEditor.java:152)
	at org.eclipse.jface.viewers.CellEditor$1.run(CellEditor.java:336)

The same "direct edit" with the "General" tab selected does not have the issue.
Comment 1 Pierre-Charles David CLA 2016-09-20 09:04:53 EDT
Quick analysis: in AbstractDTablePropertySection.createControls(Composite, TabbedPropertySheetPage) we have this test:

        if (aTabbedPropertySheetPage instanceof DTablePropertySheetpage) {
            this.parentPropertySheetPage = (DTablePropertySheetpage) aTabbedPropertySheetPage;
        }

which is always false when using the new property views, as the parent aTabbedPropertySheetPage will be a LegacyTabbedPropertySheetPage. Thus parentPropertySheetPage is never initialized, and when we invoke update() later to take the direct-edit changes into account, we get the NPE when testing "if (parentPropertySheetPage.isUpdateEnabled())"
Comment 2 Eclipse Genie CLA 2016-10-04 11:41:20 EDT
New Gerrit change created: https://git.eclipse.org/r/82464
Comment 3 Pierre-Charles David CLA 2016-10-04 11:50:23 EDT
I have not tested, but from the look of the code, the tree dialect is probably impacted too. The patch proposed in https://git.eclipse.org/r/82464 handles both.
Comment 5 Pierre-Charles David CLA 2016-10-05 02:45:08 EDT
Fixed.
Comment 6 Pierre-Charles David CLA 2016-10-18 11:07:18 EDT
Available in Sirius 4.1.0, see https://wiki.eclipse.org/Sirius/4.1.0 for details.