Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behavior Annex: Null pointer exception when calling getContainingFeature() on an instance of StructUnionElement #2199

Closed
dblouin opened this issue Feb 12, 2020 · 0 comments · Fixed by #2214
Assignees
Milestone

Comments

@dblouin
Copy link
Contributor

dblouin commented Feb 12, 2020

Summary

We use the EFM Compare framework to compare two AADL models having BA annex clauses. A null pointer exception occurs when comparing the models as shown in the trace below:

java.lang.NullPointerException
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eContainingFeature(BasicEObjectImpl.java:908)
at org.eclipse.emf.compare.match.eobject.EUriFragmentFunction.apply(EUriFragmentFunction.java:49)
at org.eclipse.emf.compare.match.eobject.EUriFragmentFunction.apply(EUriFragmentFunction.java:1)
at org.eclipse.emf.compare.match.eobject.URIDistance.retrieveFragment(URIDistance.java:187)
at org.eclipse.emf.compare.match.eobject.EditionDistance$1$1.matchingURIs(EditionDistance.java:143)
at org.eclipse.emf.compare.utils.EqualityHelper.matchingEObjects(EqualityHelper.java:251)
at org.eclipse.emf.compare.utils.EqualityHelper.matchingValues(EqualityHelper.java:170)
at
...

This occurs when calling eContainningFeature() on an instance of the StructUnionElement class of the BA metamodel.

The problem is due to the instance being added to the StructUnionElementHolder parent using the eBasicSetContainer() method passing the AadlBaPackage.STRUCT_UNION_ELEMENT_HOLDER as containing feature ID (see AadlBaTypeChecker class line 1357).

This is wrong since the passed ID is the ID of the StructUnionElementHolder class in the Ecore meta-model. As a matter of fact, there is a problem in the BA metamodel since there is no feature in the StructUnionElementHolder class to contain the StructUnionElement. The "element" reference of the StructUnionElementHolder class cannot be used for that since it is not containement.

I suggest adding an explicit reference in the StructUnionElementHolder class to contain StructUnionElement elements and modify the AadlBaTypeChecker class to use the proper reference constant.

Environment

  • OSATE Version: 2.6.0
  • Operating System:
@Etienne13 Etienne13 self-assigned this Feb 12, 2020
@Etienne13 Etienne13 added this to the 2.7.1 milestone Feb 13, 2020
@lwrage lwrage changed the title Behaviour Annex: Null pointer exception when calling getContainningFeature() on an instance of StructUnionElement Behavior Annex: Null pointer exception when calling getContainingFeature() on an instance of StructUnionElement Mar 30, 2020
@lwrage lwrage modified the milestones: 2.7.1, 2.8.0 Mar 31, 2020
@lwrage lwrage modified the milestones: 2.8.0, 2.7.1 Apr 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants