Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Problems with DerivedUnion during deserialization
Problems with DerivedUnion during deserialization [message #627858] Mon, 10 August 2009 11:39
Timothy Marc is currently offline Timothy MarcFriend
Messages: 547
Registered: July 2009
Senior Member
Hey all,

i'm using the UML2 genmodel to generate a uml-like metamodel with
subsets and unions etc. I've rebuild the Element -> ownedComment
relationship of the UML 2.2 Superstructure (Figure 7.3). Instead of
Comment, i've sed the term Annotation. The model looks like

Element {abstract}
+/owner 0..1 {union, read-only}
+/ownedElement * {union, read-only}

TestingModel extends Element
+ annotation * {subsets ownedElement}

Annotation extends Element


When i define a simple model like the model mentioned in the following
XMI snippet

<?xml version="1.0" encoding="UTF-8"?>
<union:TestingModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:union="http:///union.ecore" ownedElement="//@annotation.0">
<annotation/>
</union:TestingModel>

i ran allways in an exception during deserialization. I've tried both
the editor and the programmatically deserialization. Both fail with the
following exception trace. It seems, that somewhere the
DerivedEObjectEList.add() method will be called.

org.eclipse.emf.ecore.xmi.IllegalValueException: Value
'union.impl.AnnotationImpl@352d87' is not legal.
(platform:/resource/f/My.union, -1, -1)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XM LHandler.java:2648)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleForwardRefer ences(XMLHandler.java:1135)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.endDocument(XMLHan dler.java:1214)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .endDocument(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanDocument(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(U nknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSA XParser.parse(Unknown
Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:181)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:180)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1445)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1241)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLo ad(ResourceSetImpl.java:255)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLo adHelper(ResourceSetImpl.java:270)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResou rce(ResourceSetImpl.java:397)
at union.presentation.UnionEditor.createModel(UnionEditor.java: 950)
at union.presentation.UnionEditor.createPages(UnionEditor.java: 1007)
at
org.eclipse.ui.part.MultiPageEditorPart.createPartControl(Mu ltiPageEditorPart.java:310)
at ....


Caused by: java.lang.UnsupportedOperationException
at
org.eclipse.uml2.common.util.DerivedEObjectEList$DerivedList Iterator.add(DerivedEObjectEList.java:278)
at java.util.AbstractSequentialList.add(Unknown Source)
at
org.eclipse.uml2.common.util.DerivedEObjectEList.addUnique(D erivedEObjectEList.java:636)
at
org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.setValue(XMLHel perImpl.java:1192)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XM LHandler.java:2643)
... 58 more


For serialization and deserialization i'm using an XMIBResource(Factory)
created by the genmodel automatically. Please let me know, what is going
wrong in this really simple example.

Thanks in advance
Timothy
Previous Topic:Applying stereotypes
Next Topic:Problem while trying to export graphic from diagram
Goto Forum:
  


Current Time: Fri Dec 19 04:01:26 GMT 2014

Powered by FUDForum. Page generated in 0.01536 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software