Community
Participate
Working Groups
Steps to reproduce: 1. Create a profile with a stereotype Ste1 extending Class. 2. On the Extension_End set lower to 1 (or on Extension, set Required to true, (but it seems bugged too in Papyrus). 3. Create a new model, apply the profile previously created. 4. Create a new Class Class1. The stereotype Ste1, will be applied automatically on it (due to the lower value set to 1 in the Extension_End object. 5. Close the model 6. Open the uml file with the Ecore Editor 7. Destroy the stereotype application, save and close 8. Reopen the papyrus model. -> you will get an exception, because UML2 try to apply the required Stereotype Ste1 to the class Class1 outside of a transaction. So, in this case, we are editing the model during the load. It is a good or a bad pratice ? No Idea... I have no idea how is possible to get a model in this state, but it already appears (see Bug 537905)
This problem should appears when the user creates sub Papyrus model. Depending of the order of the profile application and submodel creation. it should be possible to obtain a state where the profile containing required stereotype is unknown from the submodel. In this case, editing the submodel, the stereotype won't be applied, but required from the point of view of the main model.
Created attachment 277464 [details] A model to reproduce the bug
Created attachment 277465 [details] stackTrace
In the attached model, there are : - a profile with a required stereotype for Class element - a model (bug543303.di file). This model contains a subpackage with a class where the required stereotype is not applied. This subpackage is in a controlled resource - a submodel Package4.di. This model contains the class which is not stereotyped but which must be stereotyped. I obtained this model, corrupting it with in a text editor. This case can appears naturally with Papyrus, due to bugs with Control Mode. During the load of the root model, the UMLSnippet registers the adapter ModelListenerManager on the resource. This action seems require to load all the model and submodel. During this load UML2 notices than required stereotypes are missing and decides to apply them. This application generates an exception (see attached stacktrace). I already tried to attache the listener using a RecordingCommand, using GMFUnsafe, using a Runnable... each time I get the exception... So I have no more idea how to fix it. I notices too than missing required stereotypes are not a problem when there are in the main resource and not in a sub resource. In this case, there is no exception, but missing stereotypes are not applied too.