XMI idref reading error [message #1734082] |
Fri, 03 June 2016 15:19 |
Raphael B Messages: 14 Registered: April 2013 |
Junior Member |
|
|
Hello,
As I was upgrading my Ecore libraries, I got the following error when reading a file:
org.eclipse.emf.ecore.xmi.IllegalValueException: Value 'org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@5607ce2 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@3c2bbbf0 (name: Element) (instanceClassName: null) (abstract: false, interface: false)) (mixed: null, anyAttribute: [XMI_20131001:idref=SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous])' is not legal.
The relevant XMI content is the following:
<packagedElement xmi:id="SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous" xmi:uuid="org.omg.sysml.SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous" xmi:type="uml:Stereotype">
<name>Continuous</name>
<ownedComment xmi:id="SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous._ownedComment.0" xmi:uuid="org.omg.sysml.SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous._ownedComment.0" xmi:type="uml:Comment">
<body>
...
</body>
<annotatedElement xmi:idref="SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous"/>
</ownedComment>
I'm guessing I get this error because the type of the annotatedElement is UML Element, which is abstract, so a proxy can't be created. Now, I don't know why a proxy would be created since the actual element should have been created already.
My code was working with EMF (ecore+ecore.xmi) 2.11.0, meaning that element with idrefs didn't require a xmi:type to be read. The code doesn't work anymore in 2.11.1, so I'm suspecting http://git.eclipse.org/c/emf/org.eclipse.emf.git/commit/?h=R2_11_maintenance&id=da4f80486a37c34d9eae223dd38fa9ee873ca36d to have introduced the problem, but I don't know EMF well enough to say.
Is there a workaround that does not involve adding an xmi:type to all idrefs?
Thanks!
|
|
|
Re: XMI idref reading error [message #1734090 is a reply to message #1734082] |
Fri, 03 June 2016 16:53 |
Ed Merks Messages: 33113 Registered: July 2009 |
Senior Member |
|
|
I'm not sure what models are involved, but better to ask on a forum
related to that specific technology. I.e., SysML or UML2 or whatever
this is supposed to represent.
On 03.06.2016 17:19, Raphael B wrote:
> Hello,
> As I was upgrading my Ecore libraries, I got the following error when
> reading a file:
> org.eclipse.emf.ecore.xmi.IllegalValueException: Value
> 'org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@5607ce2 (eClass:
> org.eclipse.emf.ecore.impl.EClassImpl@3c2bbbf0 (name: Element)
> (instanceClassName: null) (abstract: false, interface: false)) (mixed:
> null, anyAttribute:
> [XMI_20131001:idref=SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous])'
> is not legal.
>
> The relevant XMI content is the following:
> <packagedElement
> xmi:id="SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous"
> xmi:uuid="org.omg.sysml.SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous"
> xmi:type="uml:Stereotype">
> <name>Continuous</name>
> <ownedComment
> xmi:id="SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous._ownedComment.0"
> xmi:uuid="org.omg.sysml.SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous._ownedComment.0"
> xmi:type="uml:Comment">
> <body>
> ..
> </body>
> <annotatedElement
> xmi:idref="SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous"/>
> </ownedComment>
>
> I'm guessing I get this error because the type of the annotatedElement
> is UML Element, which is abstract, so a proxy can't be created. Now, I
> don't know why a proxy would be created since the actual element
> should have been created already.
> My code was working with EMF (ecore+ecore.xmi) 2.11.0, meaning that
> element with idrefs didn't require a xmi:type to be read. The code
> doesn't work anymore in 2.11.1, so I'm suspecting
> http://git.eclipse.org/c/emf/org.eclipse.emf.git/commit/?h=R2_11_maintenance&id=da4f80486a37c34d9eae223dd38fa9ee873ca36d
> to have introduced the problem, but I don't know EMF well enough to say.
>
> Is there a workaround that does not involve adding an xmi:type to all
> idrefs?
>
> Thanks!
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Re: XMI idref reading error [message #1734116 is a reply to message #1734090] |
Sat, 04 June 2016 06:11 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi
This does appear to be an EMF problem, albeit a crazy one.
The problem does not appear to be new. I see it with EMF 2.11.0.
The user's snippet enables the source to be identified as
http://www.omg.org/spec/SysML/20150709/SysML.xmi.
The XMI is incredibly bloated and close to criminal. ID and UUID, with
element style IDREFs to maximize the character count for simple
attributes. It is doubtful that the UUIDs will be stable.
Using the debugger suggests that the problem is actually caused when
XMIHandler.createObject(EObject peekObject, EStructuralFeature feature)
passes the first four if's and goes to super.createObject. It would
appear that the case of an xmi:idref, !isContainment(), isMany(),
isResolveProxies() and an abstract feature type has not been encountered
before. The abstract feature causes a failure when an
org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl is added to the list.
Regards
Ed Willink
On 03/06/2016 17:53, Ed Merks wrote:
> I'm not sure what models are involved, but better to ask on a forum
> related to that specific technology. I.e., SysML or UML2 or whatever
> this is supposed to represent.
>
>
> On 03.06.2016 17:19, Raphael B wrote:
>> Hello,
>> As I was upgrading my Ecore libraries, I got the following error when
>> reading a file:
>> org.eclipse.emf.ecore.xmi.IllegalValueException: Value
>> 'org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@5607ce2 (eClass:
>> org.eclipse.emf.ecore.impl.EClassImpl@3c2bbbf0 (name: Element)
>> (instanceClassName: null) (abstract: false, interface: false))
>> (mixed: null, anyAttribute:
>> [XMI_20131001:idref=SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous])'
>> is not legal.
>>
>> The relevant XMI content is the following:
>> <packagedElement
>> xmi:id="SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous"
>> xmi:uuid="org.omg.sysml.SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous"
>> xmi:type="uml:Stereotype">
>> <name>Continuous</name>
>> <ownedComment
>> xmi:id="SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous._ownedComment.0"
>> xmi:uuid="org.omg.sysml.SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous._ownedComment.0"
>> xmi:type="uml:Comment">
>> <body>
>> ..
>> </body>
>> <annotatedElement
>> xmi:idref="SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous"/>
>> </ownedComment>
>>
>> I'm guessing I get this error because the type of the
>> annotatedElement is UML Element, which is abstract, so a proxy can't
>> be created. Now, I don't know why a proxy would be created since the
>> actual element should have been created already.
>> My code was working with EMF (ecore+ecore.xmi) 2.11.0, meaning that
>> element with idrefs didn't require a xmi:type to be read. The code
>> doesn't work anymore in 2.11.1, so I'm suspecting
>> http://git.eclipse.org/c/emf/org.eclipse.emf.git/commit/?h=R2_11_maintenance&id=da4f80486a37c34d9eae223dd38fa9ee873ca36d
>> to have introduced the problem, but I don't know EMF well enough to say.
>>
>> Is there a workaround that does not involve adding an xmi:type to all
>> idrefs?
>>
>> Thanks!
>
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04272 seconds