Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Invalid entry feature exception from DelegatingFeatureMap.validate when switching to EStore
icon5.gif  Invalid entry feature exception from DelegatingFeatureMap.validate when switching to EStore [message #664141] Thu, 07 April 2011 15:39 Go to next message
Preston Appel is currently offline Preston AppelFriend
Messages: 6
Registered: July 2009
Junior Member
I have inherited some EMF models--a number of them, actually--and I need to convert them to use EStore. This code is running on the org.eclipse.emf.ecore_2.7.0.v20110310-1642 feature. I think that's M6a Indigo. I'm getting an odd error after I moved to using EStore. Here's the relevant part of the stack trace:

java.lang.RuntimeException: Invalid entry feature 'AbstractBaseTag.childTags'
at org.eclipse.emf.ecore.util.DelegatingFeatureMap.validate(Del egatingFeatureMap.java:96)
at org.eclipse.emf.ecore.util.DelegatingFeatureMap.addUnique(De legatingFeatureMap.java:1516)
at org.eclipse.emf.ecore.util.DelegatingFeatureMap.addUnique(De legatingFeatureMap.java:1)
at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList. java:307)
at org.eclipse.emf.ecore.util.DelegatingFeatureMap.doAdd(Delega tingFeatureMap.java:536)
at org.eclipse.emf.ecore.util.DelegatingFeatureMap.add(Delegati ngFeatureMap.java:1268)
at org.eclipse.emf.ecore.util.FeatureMapUtil$FeatureEList.add(F eatureMapUtil.java:751)
at oracle.eclipse.tools.webtier.adf.jsp.document.PanelFormLayou tFieldsGenerator.addField(PanelFormLayoutFieldsGenerator.jav a:150)

To explain what kicks off that stack trace, I have a statically-generated class called PanelLabelAndMessageType on which I call getChildTags(), followed by an add method call on the EList that's returned by getChildTags(). This happens in the addField method in the stack trace.

For the models, I have an ecore model called jsptagbase that is imported and used from a lot of other ecore models. Here's the relevant portion that generates the getChildTags method.

<eStructuralFeatures xsi:type="ecore:EAttribute" name="mixed" unique="false" upperBound="-1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFeatureMapEntry"
volatile="true">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="elementWildcard"/>
<details key="name" value=":mixed"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="childTags" upperBound="-1"
eType="#//AbstractBaseTag" volatile="true" transient="true" derived="true">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="group" value="#:mixed"/>
<details key="kind" value="elementOnly"/>
</eAnnotations>
</eStructuralFeatures>

Like I said, I inherited these models, so I'm having a little trouble interpreting them, but it looks like there is a mixed attribute and the childTags attribute is referencing it. I believe the basic intention, though, is that the classes that extend AbstractBaseTag can have heterogeneous child AbstractBaseTag subclasses added to them, which will be stored in the childTags feature.

Here's what the generated code looks like:

public FeatureMap getMixed()
{
return (FeatureMap)eGet(JsptagbasePackage.Literals.ABSTRACT_BASE_TA G__MIXED, true);
}

public EList<AbstractBaseTag> getChildTags()
{
return (EList<AbstractBaseTag> )eGet(JsptagbasePackage.Literals.ABSTRACT_BASE_TAG__CHILD_TA GS, true);
}

Since I'm moving to an EStore implementation, the genmodel has Feature Delegation set to Reflective.

In trying to debug this issue, DelegatingFeatureMap's validate(int index, Entry object) method calls isValid(EStructuralFeature) on its featureMapValidator, which is a FeatureMapUtil.BasicValidator. I found that in the BasicValidator's isValid(EStructuralFeature) method, the childTags EStructuralFeature was put in the cache data member with a value of false. Here's how that happens:

Debugging through the call to the BasicValidator isValid(EStructuralFeature) method for the childTags EStructuralFeature, the data members for the BasicValidator are:
cache: empty initially
containingClass: PanelLabelAndMessageType
eStructuralFeature: EStructuralFeature for mixed
groupMembers: empty
isElement: true
name: null
wildcards: [http://www.eclipse.org/emf/2003/XMLTYPE]

For reference, here's the method:

public boolean isValid(EStructuralFeature feature)
{
if (eStructuralFeature == feature) return true;

Boolean result = cache.get(feature);
if (result == null)
{
if (isIncluded(feature))
{
cache.put(feature, Boolean.TRUE);
return true;
}
else
{
cache.put(feature, Boolean.FALSE);
return false;
}
}
else
{
return result == Boolean.TRUE;
}
}

Continuing through the isValid(EStructuralFeature) call, the cache returns null when it first tries to get the feature, so isIncluded(feature) is called, which returns false. So the cache data member is updated by adding the childTags EStructuralFeature with a value of false. And this and any subsequent calls to isValid return false for the childTags EStructuralFeature, which is what we see at the top of the stack trace.

I suspect that the mixed and/or childTags features are wrong in the jsptagbase.ecore model for the EStore case, but I'm not sure.

Any help you can give me would be much appreciated. Thanks.

Preston
Re: Invalid entry feature exception from DelegatingFeatureMap.validate when switching to EStore [message #664165 is a reply to message #664141] Thu, 07 April 2011 16:59 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30551
Registered: July 2009
Senior Member
Preston,

Comments below.

Preston Appel wrote:
> I have inherited some EMF models--a number of them, actually--and I
> need to convert them to use EStore. This code is running on the
> org.eclipse.emf.ecore_2.7.0.v20110310-1642 feature. I think that's
> M6a Indigo. I'm getting an odd error after I moved to using EStore.
> Here's the relevant part of the stack trace:
>
> java.lang.RuntimeException: Invalid entry feature
> 'AbstractBaseTag.childTags'
> at org.eclipse.emf.ecore.util.DelegatingFeatureMap.validate(Del
> egatingFeatureMap.java:96)
> at org.eclipse.emf.ecore.util.DelegatingFeatureMap.addUnique(De
> legatingFeatureMap.java:1516)
> at org.eclipse.emf.ecore.util.DelegatingFeatureMap.addUnique(De
> legatingFeatureMap.java:1)
> at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.
> java:307)
> at org.eclipse.emf.ecore.util.DelegatingFeatureMap.doAdd(Delega
> tingFeatureMap.java:536)
> at org.eclipse.emf.ecore.util.DelegatingFeatureMap.add(Delegati
> ngFeatureMap.java:1268)
> at org.eclipse.emf.ecore.util.FeatureMapUtil$FeatureEList.add(F
> eatureMapUtil.java:751)
> at oracle.eclipse.tools.webtier.adf.jsp.document.PanelFormLayou
> tFieldsGenerator.addField(PanelFormLayoutFieldsGenerator.jav a:150)
>
> To explain what kicks off that stack trace, I have a
> statically-generated class called PanelLabelAndMessageType on which I
> call getChildTags(), followed by an add method call on the EList
> that's returned by getChildTags(). This happens in the addField
> method in the stack trace.
>
> For the models, I have an ecore model called jsptagbase that is
> imported and used from a lot of other ecore models. Here's the
> relevant portion that generates the getChildTags method.
>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="mixed"
> unique="false" upperBound="-1"
> eType="ecore:EDataType
> http://www.eclipse.org/emf/2002/Ecore#//EFeatureMapEntry"
> volatile="true">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="elementWildcard"/>
> <details key="name" value=":mixed"/>
> </eAnnotations>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EReference" name="childTags"
> upperBound="-1"
> eType="#//AbstractBaseTag" volatile="true" transient="true"
> derived="true">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="group" value="#:mixed"/>
> <details key="kind" value="elementOnly"/>
I suspect this should be value="element". Probably isIncluded is
returning false because only features that are elements are allowed in
the feature map.
> </eAnnotations>
> </eStructuralFeatures>
>
> Like I said, I inherited these models, so I'm having a little trouble
> interpreting them, but it looks like there is a mixed attribute and
> the childTags attribute is referencing it. I believe the basic
> intention, though, is that the classes that extend AbstractBaseTag can
> have heterogeneous child AbstractBaseTag subclasses added to them,
> which will be stored in the childTags feature.
>
> Here's what the generated code looks like:
>
> public FeatureMap getMixed()
> {
> return
> (FeatureMap)eGet(JsptagbasePackage.Literals.ABSTRACT_BASE_TA G__MIXED,
> true);
> }
>
> public EList<AbstractBaseTag> getChildTags()
> {
> return (EList<AbstractBaseTag>
> )eGet(JsptagbasePackage.Literals.ABSTRACT_BASE_TAG__CHILD_TA GS, true);
> }
>
> Since I'm moving to an EStore implementation, the genmodel has Feature
> Delegation set to Reflective.
>
> In trying to debug this issue, DelegatingFeatureMap's validate(int
> index, Entry object) method calls isValid(EStructuralFeature) on its
> featureMapValidator, which is a FeatureMapUtil.BasicValidator. I
> found that in the BasicValidator's isValid(EStructuralFeature) method,
> the childTags EStructuralFeature was put in the cache data member with
> a value of false. Here's how that happens:
>
> Debugging through the call to the BasicValidator
> isValid(EStructuralFeature) method for the childTags
> EStructuralFeature, the data members for the BasicValidator are:
> cache: empty initially
> containingClass: PanelLabelAndMessageType
> eStructuralFeature: EStructuralFeature for mixed
> groupMembers: empty
> isElement: true
> name: null
> wildcards: [http://www.eclipse.org/emf/2003/XMLTYPE]
>
> For reference, here's the method:
>
> public boolean isValid(EStructuralFeature feature)
> {
> if (eStructuralFeature == feature) return true;
>
> Boolean result = cache.get(feature);
> if (result == null)
> {
> if (isIncluded(feature))
> {
> cache.put(feature, Boolean.TRUE);
> return true;
> }
> else
> {
> cache.put(feature, Boolean.FALSE);
> return false;
> }
> }
> else
> {
> return result == Boolean.TRUE;
> }
> }
>
> Continuing through the isValid(EStructuralFeature) call, the cache
> returns null when it first tries to get the feature, so
> isIncluded(feature) is called, which returns false. So the cache data
> member is updated by adding the childTags EStructuralFeature with a
> value of false. And this and any subsequent calls to isValid return
> false for the childTags EStructuralFeature, which is what we see at
> the top of the stack trace.
>
> I suspect that the mixed and/or childTags features are wrong in the
> jsptagbase.ecore model for the EStore case, but I'm not sure.
>
> Any help you can give me would be much appreciated. Thanks.
>
> Preston
Re: Invalid entry feature exception from DelegatingFeatureMap.validate when switching to EStore [message #664208 is a reply to message #664141] Thu, 07 April 2011 20:07 Go to previous message
Preston Appel is currently offline Preston AppelFriend
Messages: 6
Registered: July 2009
Junior Member
Thanks, Ed! That fixed it.
Previous Topic:'src' folder appears empty in Package Explorer view after EMF Java generation
Next Topic:"Class variable"-like behaviour in Ecore model
Goto Forum:
  


Current Time: Sun Oct 20 14:32:52 GMT 2019

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

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

Back to the top