Bug 431121 - [Layers] IllegalStateException on Editor closing
Summary: [Layers] IllegalStateException on Editor closing
Status: NEW
Alias: None
Product: Papyrus
Classification: Modeling
Component: Others (show other bugs)
Version: 1.0.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: M7   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 330199
  Show dependency tree
 
Reported: 2014-03-25 10:49 EDT by Cedric Dumoulin CLA
Modified: 2017-09-08 11:41 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Cedric Dumoulin CLA 2014-03-25 10:49:39 EDT
Closing Papyrus editor throw  java.lang.IllegalStateException when the layers are attached to a diagram.
How to reproduce:
- create a model with a class diagram
- attach a LayerStack to the diagram
- close the Papyrus editor.
  ==> an exception is thrown.
  
  Caused by: java.lang.IllegalStateException: Cannot modify resource set without a write transaction
	at org.eclipse.emf.transaction.impl.TransactionChangeRecorder.assertWriting(TransactionChangeRecorder.java:348)
	at org.eclipse.emf.transaction.impl.TransactionChangeRecorder.appendNotification(TransactionChangeRecorder.java:302)
	at org.eclipse.papyrus.infra.emf.readonly.PapyrusROTransactionalEditingDomain$1.appendNotification(PapyrusROTransactionalEditingDomain.java:82)
	at org.eclipse.emf.transaction.impl.TransactionChangeRecorder.processResourceNotification(TransactionChangeRecorder.java:272)
	at org.eclipse.emf.transaction.impl.TransactionChangeRecorder.notifyChanged(TransactionChangeRecorder.java:238)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
	at org.eclipse.emf.common.notify.impl.NotifyingListImpl.dispatchNotification(NotifyingListImpl.java:261)
	at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:294)
	at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:303)
	at org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResource.addModelRoot(AbstractModelWithSharedResource.java:207)
	at org.eclipse.papyrus.layers.runtime.model.LayersModel.getLayerStackApplication(LayersModel.java:96)
	at org.eclipse.papyrus.layers.runtime.LayersStackApplicationEventNotifier.deactivate(LayersStackApplicationEventNotifier.java:114)
	at org.eclipse.papyrus.layers.runtime.LayersStackAndApplicationLifeCycleEventNotifier.deactivateLayersStackLifeCycleEventNotifier(LayersStackAndApplicationLifeCycleEventNotifier.java:184)
	at org.eclipse.papyrus.layers.runtime.LayersStackAndApplicationLifeCycleEventNotifier.transitionApplicationCreatedToNoApplicationState(LayersStackAndApplicationLifeCycleEventNotifier.java:134)
	at org.eclipse.papyrus.layers.runtime.LayersStackAndApplicationLifeCycleEventNotifier.access$0(LayersStackAndApplicationLifeCycleEventNotifier.java:133)
	at org.eclipse.papyrus.layers.runtime.LayersStackAndApplicationLifeCycleEventNotifier$1.layersModelRootRemoved(LayersStackAndApplicationLifeCycleEventNotifier.java:65)
	at org.eclipse.papyrus.layers.runtime.model.LayersModelEventRootNotifier.fireLayersModelRootRemovedEvent(LayersModelEventRootNotifier.java:170)
	at org.eclipse.papyrus.layers.runtime.model.LayersModelEventRootNotifier$1.notifyChanged(LayersModelEventRootNotifier.java:72)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
	at org.eclipse.emf.common.notify.impl.NotifyingListImpl.dispatchNotification(NotifyingListImpl.java:261)
	at org.eclipse.emf.common.notify.impl.NotifyingListImpl.clear(NotifyingListImpl.java:1090)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.doUnload(ResourceImpl.java:1641)
	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doUnload(XMLResourceImpl.java:681)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.unload(ResourceImpl.java:1663)
	at org.eclipse.papyrus.infra.core.resource.AbstractBaseModel.unload(AbstractBaseModel.java:261)
	at org.eclipse.papyrus.infra.core.resource.EMFLogicalModel.unload(EMFLogicalModel.java:77)
	at org.eclipse.papyrus.infra.core.resource.ModelSet.unload(ModelSet.java:921)
	at org.eclipse.papyrus.infra.services.resourceloading.OnDemandLoadingModelSet.unload(OnDemandLoadingModelSet.java:57)
	at org.eclipse.papyrus.infra.services.resourceloading.OnDemandLoadingModelSetServiceFactory.disposeService(OnDemandLoadingModelSetServiceFactory.java:51)
	at org.eclipse.papyrus.infra.core.services.internal.ServiceFactoryEntry.disposeService(ServiceFactoryEntry.java:169)
	at org.eclipse.papyrus.infra.core.services.internal.StartStartupEntry.disposeService(StartStartupEntry.java:80)
	at org.eclipse.papyrus.infra.core.services.ServicesRegistry.disposeServices(ServicesRegistry.java:993)
	at org.eclipse.papyrus.infra.core.services.ServicesRegistry.disposeRegistry(ServicesRegistry.java:854)
	... 74 more
Comment 1 Cedric Dumoulin CLA 2014-03-25 11:04:05 EDT
The getLayerStackApplication() method try to create the object if it is not found. But, if we are in the dispose mode, we should not create object.

What is surprising, is the fact that the dispose() method is called because an event indicating that the application object is removed from the model !
This is strange because we are currently closing the editor and the models. We are not trying to change the models.
It seems that the Resource.unload() methods remove the objects, and that corresponding event are fired.