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

Check for null containing classifier in Aadl2LinkingService::getLinkedObjects #2139

Closed
brlarson opened this issue Dec 27, 2019 · 1 comment · Fixed by #2240
Closed

Check for null containing classifier in Aadl2LinkingService::getLinkedObjects #2139

brlarson opened this issue Dec 27, 2019 · 1 comment · Fixed by #2240
Assignees
Milestone

Comments

@brlarson
Copy link

Summary

When linking inside an annex library, a NullPointerException is thrown because
line 224: aadl Classifier ns = AadlUtil.getContainingClassifier(context);
returns null, because there is no containing classifier for an annex library.

Please check for (ns != null) before use and return an empty list instead (line 249)

  if (ns != null)
    {
    EObject searchResult = AadlUtil.findNamedElementInList(ns.getAllFeatures(), name);
    if (searchResult != null && searchResult instanceof Port)
      {
      return Collections.singletonList(searchResult);
      }
    }
  return Collections.<EObject> emptyList();

Environment

  • OSATE Version: 2.6.1
  • Operating System: macOS 10.14.6
@lwrage
Copy link
Contributor

lwrage commented Mar 14, 2020

The implementation of Aadl2LinkingService.getLinkedObjects() assumes in many places that it is only called in the context of core AADL. The name resolution for references inside any annex must happen in an annex specific linking service.
The real bug is that the Aadl2LinkingService tries to resolve references inside an annex if

  • no annex linking service is registered or
  • an annex linking service is registered bit encounters an unresolvable reference

instead of just returning an empty list in these cases.

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.

2 participants