NASA-AMMOS / aerie

A software framework for modeling spacecraft.
https://nasa-ammos.github.io/aerie-docs/
MIT License
73 stars 19 forks source link

NPE fix #1574

Closed bradNASA closed 1 month ago

bradNASA commented 1 month ago

NPE fix, untested

mattdailis commented 1 month ago

Discussed with Theresa, and we decided to refactor these two lines of code:

https://github.com/NASA-AMMOS/aerie/blob/ac8720e5a10a391373724ead9033d01d226a5bf7/merlin-driver/src/main/java/gov/nasa/jpl/aerie/merlin/driver/engine/SimulationEngine.java#L831

To this:

+(activityParents.containsKey(span)) ? Optional.empty() : Optional.ofNullable(directiveId)
-Optional.ofNullable(directiveId)

The ternary dates back to a time when we used the absence of a parent span to determine whether a span is "top level", and assumed that all top level spans came from the plan. Now, we have a more direct way to compute directive ids, which is robust to the situation where a parent-less span comes from a daemon task rather than a directive in the plan.

dandelany commented 1 month ago

Thanks all! Merging this fix.