openEHR / archie

OpenEHR library implementing ADL 2, AOM 2, BMM, RM 1.0.4 and many tools
Apache License 2.0
53 stars 25 forks source link

Null pointer exception if occurences == null in parent and child #635

Open wolandscat opened 1 month ago

wolandscat commented 1 month ago

See here in the routine SpecializedOccurrencesValidation.childNodesConformToParent.

The code does not handle the simple case when the parent archetype has no occurrences on a node and the child archetype doesn't mention the node, or else also has no occurrences on it.

The fix I made is to change the test to:

        if(parentCObject.getNodeId().equals(childCObject.getNodeId()) &&
                parentNodeOccurrences == null? childNodeOccurrences == null:
                parentNodeOccurrences.equals(childNodeOccurrences))

Raising here in case I don't manage to raise a proper PR with new test.