Skip to content

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

@brlarson

Description

@brlarson

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions