[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.mdt.uml2] Re: Problems with DerivedUnion during deserialization

Timothy,

I wouldn't have expected to see an 'ownedElement' element in the serialization, since derived unions are, by definition read-only (hence the reason why the addition is failing upon deserialization). Did you make that feature transient in the metamodel?

Kenn

Timothy Marc wrote:
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(XMLHandler.java:2648)


at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleForwardReferences(XMLHandler.java:1135)

at org.eclipse.emf.ecore.xmi.impl.XMLHandler.endDocument(XMLHandler.java:1214)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.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(XMLResourceImpl.java:180)


at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1445)

at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1241)

at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:255)

at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:270)

at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(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(MultiPageEditorPart.java:310)


    at ....


Caused by: java.lang.UnsupportedOperationException
at org.eclipse.uml2.common.util.DerivedEObjectEList$DerivedListIterator.add(DerivedEObjectEList.java:278)


at java.util.AbstractSequentialList.add(Unknown Source)
at org.eclipse.uml2.common.util.DerivedEObjectEList.addUnique(DerivedEObjectEList.java:636)


at org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.setValue(XMLHelperImpl.java:1192)

at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XMLHandler.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