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

Bug 368825

Summary: [SysML 1.1][Requirement] Creation of SysML Decompose fails for classes manually stereotyped as requirements
Product: [Modeling] Papyrus Reporter: Stefano puri <stefano.puri>
Component: SysMLAssignee: Project Inbox <mdt-papyrus-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: klaas.gadeyne
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Papyrus project to reproduce the bug none

Description Stefano puri CLA 2012-01-17 08:56:38 EST
Build Identifier:  M20110909-1335

After assigning the Requirement stereotype ar a stereotype deriving from Requirement (as in a more significant scenario) to a class X, then when trying to trace a Decompose relationship from X to another requirement an error occur with the following stack trace

java.lang.ClassCastException: org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure cannot be cast to org.eclipse.gmf.runtime.diagram.ui.figures.BorderedNodeFigure
	at org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart.getBorderedFigure(AbstractBorderedShapeEditPart.java:63)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart.getMainFigure(AbstractBorderedShapeEditPart.java:54)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart.addBorderItem(AbstractBorderedShapeEditPart.java:148)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart.addChildVisual(AbstractBorderedShapeEditPart.java:93)
	at org.eclipse.papyrus.diagram.clazz.edit.parts.DefaultNamedElementEditPart.addChildVisual(DefaultNamedElementEditPart.java:185)
	at org.eclipse.gef.editparts.AbstractEditPart.addChild(AbstractEditPart.java:211)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.addChild(GraphicalEditPart.java:1319)
	at org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(AbstractEditPart.java:781)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.handleNotificationEvent(GraphicalEditPart.java:1464)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeEditPart.handleNotificationEvent(ShapeEditPart.java:183)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart.handleNotificationEvent(ShapeNodeEditPart.java:236)
	at org.eclipse.papyrus.diagram.common.editparts.NodeEditPart.handleNotificationEvent(NodeEditPart.java:66)

Reproducible: Always

Steps to Reproduce:
1.create a class C in the model
2.stereotype it with Requirement (or any stereotype deriving from Requirement)
3.import C in the requirement diagram
4.try to trace a Decompose relationship from C to any other requirement
Comment 1 Klaas Gadeyne CLA 2013-02-12 09:45:40 EST
I've somehow reproduced this bug in juno SR1 on mac os x

Unfortunately, I cannot reproduce it consistently :-(

What I did:
1/ Create a papyrus UML model using the wizard
2/ Add some use cases to the model in a use case diagram
3/ [decided I wanted to have requirements].  Apply the sysml profile on the model, only selecting the requirements
4/ Create a requirements diagram.  Drag some requirements onto the diagram.  Drag the previously created use cases on the requirements diagram.
5/ Close and reopen the model -> Same bug appears.

When looking closer at the notation file, I saw some graphical objects which didn't have a stereotype_Annotation set (ie. the use cases created in step 2 above).
When I removed these objects from the notation file, I could successfully reopen the model (without having the use cases on the requirements diagram ofcourse).

The bug/workaround is also mentioned at <http://beloblotskiy.blogspot.be/2012/07/papyrus-broken-diagram.html> (not by me)
Comment 2 Camille Letavernier CLA 2013-03-13 12:18:00 EDT
java.lang.ClassCastException: org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure cannot be cast to org.eclipse.gmf.runtime.diagram.ui.figures.BorderedNodeFigure
	at org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart.getBorderedFigure(AbstractBorderedShapeEditPart.java:63)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart.getMainFigure(AbstractBorderedShapeEditPart.java:54)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart.addBorderItem(AbstractBorderedShapeEditPart.java:148)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart.addChildVisual(AbstractBorderedShapeEditPart.java:93)
	at org.eclipse.papyrus.uml.diagram.clazz.edit.parts.DefaultNamedElementEditPart.addChildVisual(DefaultNamedElementEditPart.java:179)
	at org.eclipse.gef.editparts.AbstractEditPart.addChild(AbstractEditPart.java:211)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.addChild(GraphicalEditPart.java:1319)
	at org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(AbstractEditPart.java:781)
	at org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractEditPart.java:726)
	at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh(AbstractGraphicalEditPart.java:644)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.access$3(GraphicalEditPart.java:1)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart$3.run(GraphicalEditPart.java:861)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive(TransactionalEditingDomainImpl.java:328)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.refresh(GraphicalEditPart.java:851)
	at org.eclipse.papyrus.uml.diagram.common.editparts.UMLNodeEditPart.refresh(UMLNodeEditPart.java:87)
	at org.eclipse.gef.editparts.AbstractEditPart.addNotify(AbstractEditPart.java:253)
	at org.eclipse.gef.editparts.AbstractGraphicalEditPart.addNotify(AbstractGraphicalEditPart.java:223)
	at org.eclipse.gef.editparts.AbstractEditPart.addChild(AbstractEditPart.java:212)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.addChild(GraphicalEditPart.java:1319)
	at org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(AbstractEditPart.java:781)
	at org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractEditPart.java:726)
	at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh(AbstractGraphicalEditPart.java:644)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.access$3(GraphicalEditPart.java:1)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart$3.run(GraphicalEditPart.java:861)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive(TransactionalEditingDomainImpl.java:328)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.refresh(GraphicalEditPart.java:851)
	at org.eclipse.gef.editparts.AbstractEditPart.addNotify(AbstractEditPart.java:253)
	at org.eclipse.gef.editparts.AbstractGraphicalEditPart.addNotify(AbstractGraphicalEditPart.java:223)
	at org.eclipse.gef.editparts.AbstractEditPart.addChild(AbstractEditPart.java:212)
	at org.eclipse.gef.editparts.SimpleRootEditPart.setContents(SimpleRootEditPart.java:105)
	at org.eclipse.gef.ui.parts.AbstractEditPartViewer.setContents(AbstractEditPartViewer.java:617)
	at org.eclipse.gmf.runtime.diagram.ui.parts.DiagramGraphicalViewer.setContents(DiagramGraphicalViewer.java:352)
	at org.eclipse.gef.ui.parts.AbstractEditPartViewer.setContents(AbstractEditPartViewer.java:626)
	at org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor.initializeGraphicalViewerContents(DiagramEditor.java:872)
	at org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor.initializeGraphicalViewer(DiagramEditor.java:865)
	at org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorWithFlyOutPalette.initializeGraphicalViewer(DiagramEditorWithFlyOutPalette.java:116)
	at org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor.initializeGraphicalViewer(DiagramDocumentEditor.java:174)
	at org.eclipse.papyrus.uml.diagram.clazz.part.UMLDiagramEditor.initializeGraphicalViewer(UMLDiagramEditor.java:469)
	at org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor.createGraphicalViewer(DiagramEditor.java:807)
	at org.eclipse.papyrus.sysml.diagram.requirement.RequirementDiagramForMultiEditor.createGraphicalViewer(RequirementDiagramForMultiEditor.java:97)
	
	
Steps to reproduce:

- Create a Req Diagram
- Create a Requirement (Requirement1)
- Create a Class (Class1)
- Add the Requirement stereotype to Class1
- Hide the stereotype display for Class1
- Try to create a Decompose from Class1 to Requirement1: It doesn't work, an exception is thrown
- Save
- Reopen the model: The diagram is crashed
Comment 3 Camille Letavernier CLA 2013-03-13 12:20:09 EDT
Created attachment 228367 [details]
Papyrus project to reproduce the bug

Try to open the model. Both Requirement diagrams are crashed.
Comment 4 Vincent Lorenzo CLA 2018-12-20 09:32:37 EST
SysML 1.1 is no maintained anymore. We are closing the bug as wontfix.