Bug 451182 - Cannot close unsaved diagram
Summary: Cannot close unsaved diagram
Status: NEW
Alias: None
Product: Sirius
Classification: Modeling
Component: Diagram (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P5 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo, triaged
Depends on:
Blocks:
 
Reported: 2014-11-12 10:09 EST by Udo Walker CLA
Modified: 2018-02-20 04:44 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Udo Walker CLA 2014-11-12 10:09:40 EST
From some point on while I tried to create an ecore diagram for my existing ecore model I tried to close a damaged diagram file without saving the changed contents.

I cannot close the editor in Eclipse anymore because I cannot save and I cannot close without saving.

In the error log there is this entry: (It is Ecore Diagram Editor version 2.0.2)

eclipse.buildId=4.4.1.M20140925-0400
java.version=1.7.0_72
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Framework arguments:  -product org.eclipse.epp.package.dsl.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.dsl.product


Created Time: 2014-11-12 15:53:43.049

org.eclipse.ui
Error
Wed Nov 12 15:57:08 CET 2014
Unhandled event loop exception

java.lang.NullPointerException
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl$Lookup.featureKind(XMLSaveImpl.java:3029)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl$Lookup.listKinds(XMLSaveImpl.java:2934)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl$Lookup.getFeatures(XMLSaveImpl.java:2821)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1252)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1224)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2716)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1181)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1042)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany(XMLSaveImpl.java:2417)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1553)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1224)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2716)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1181)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1042)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany(XMLSaveImpl.java:2417)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1553)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1224)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2716)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XMLSaveImpl.java:683)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveImpl.java:591)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl.java:251)
	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLResourceImpl.java:389)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:1430)
	at org.eclipse.sirius.business.internal.session.danalysis.ResourceSaveDiagnose.hasDifferentSerialization(ResourceSaveDiagnose.java:81)
	at org.eclipse.sirius.business.api.session.SavingPolicyImpl.hasChangesToSave(SavingPolicyImpl.java:84)
	at org.eclipse.sirius.business.api.session.SavingPolicyImpl.shouldSave(SavingPolicyImpl.java:95)
	at org.eclipse.sirius.business.api.session.SavingPolicyImpl.access$0(SavingPolicyImpl.java:94)
	at org.eclipse.sirius.business.api.session.SavingPolicyImpl$1.apply(SavingPolicyImpl.java:62)
	at org.eclipse.sirius.business.api.session.SavingPolicyImpl$1.apply(SavingPolicyImpl.java:1)
	at com.google.common.collect.Iterators$7.computeNext(Iterators.java:647)
	at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
	at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
	at com.google.common.collect.Iterators.addAll(Iterators.java:356)
	at com.google.common.collect.Lists.newArrayList(Lists.java:146)
	at com.google.common.collect.Lists.newArrayList(Lists.java:128)
	at org.eclipse.sirius.business.api.session.SavingPolicyImpl.computeResourcesToSave(SavingPolicyImpl.java:65)
	at org.eclipse.sirius.business.api.session.AbstractSavingPolicy$1.run(AbstractSavingPolicy.java:70)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2313)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2295)
	at org.eclipse.sirius.business.api.session.AbstractSavingPolicy.save(AbstractSavingPolicy.java:68)
	at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.save(DAnalysisSessionImpl.java:848)
	at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.save(DAnalysisSessionImpl.java:835)
	at org.eclipse.sirius.ui.business.internal.session.RestoreToLastSavePointListener.returnToSyncState(RestoreToLastSavePointListener.java:102)
	at org.eclipse.sirius.ui.business.internal.session.EditingSession.promptToSaveOnClose(EditingSession.java:251)
	at org.eclipse.sirius.diagram.ui.tools.internal.editor.DDiagramEditorImpl.promptToSaveOnClose(DDiagramEditorImpl.java:1832)
	at org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelper.java:237)
	at org.eclipse.ui.internal.SaveablesList.preCloseParts(SaveablesList.java:369)
	at org.eclipse.ui.internal.SaveablesList.preCloseParts(SaveablesList.java:348)
	at org.eclipse.ui.internal.WorkbenchWindow$7.save(WorkbenchWindow.java:583)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.savePart(PartServiceImpl.java:1322)
	at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.closePart(StackRenderer.java:1221)
	at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.access$3(StackRenderer.java:1204)
	at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer$12.close(StackRenderer.java:1095)
	at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1874)
	at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:288)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4172)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
	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:648)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Comment 1 Esteban DUGUEPEROUX CLA 2014-11-13 03:12:36 EST
Hi Udo,

Can you provide an example to reproduce your exception?

Best Regards.
Comment 2 Pierre-Charles David CLA 2014-12-23 09:55:46 EST
I tried reproducing similar errors using Ecore Tools, but could not find what could cause them.

Anyway there are two bugs here:
1. XMLSaveImpl.save() fails with an NPE. This may be a bug in EMF itself, or in EcoreTools which produces corrupted ecore models that XMLSaveImpl can not handle. I'm putting Cédric (who maintains Ecore Tools 2) in CC to see if this stack rings a bell to him.
2. Sirius is not robust enough in the face of saving errors in the semantic models. We should detect and report it more gracefully, and not block the user in a situation where he can neither save nor close the editors (which require saving).

The second is the one that concerns Sirius, and is probably true regardless of the details of the saving failure.
Comment 3 Eclipse Genie CLA 2015-09-15 10:28:37 EDT
New Gerrit change created: https://git.eclipse.org/r/55987
Comment 4 Pierre-Charles David CLA 2015-12-15 04:10:44 EST
Moving out of the 4.0 scope for now, along with all the other issues which were there "by default". This does not mean some of these will not be re-integrated at some point, but for now these issues are not part of the roadmap for 4.0.

If you feel strongly about this removal from 4.0 and/or are ready to sponsor the corresponding work, feel free to comment.