Exception parsing empty CCSDS OEM comment

thank you for this great project!
I tried to parse the CSSDS OEM trajectories from https://spotthestation.nasa.gov/trajectory_data.cfm.
The XML-file is successfully parsed by Orekit, when the OEM embedded in NDM format is considered.
The TXT file contains empty comments, such as "COMMENT " - this is probably okay, as the specification https://public.ccsds.org/Pubs/502x0b2c1e2.pdf does not require text afterwards (empty remainder):

6.7.4 All comment lines shall begin with the ‘ COMMENT ’ keyword followed by at least one
space. This keyword must appear on every comment line, not just the first such line. The
remainder of the line shall be the comment value.[…]

But Orekit (11.0.2) throws an exceptions when encountering this:

org.orekit.errors.OrekitException: unable to parse line 29 of file ISS.txt:
at org.orekit.files.ccsds.ndm.odm.oem.OemParser.processKvnDataToken(OemParser.java:364)
at org.orekit.files.ccsds.utils.parsing.AbstractMessageParser.process(AbstractMessageParser.java:180)
at org.orekit.files.ccsds.utils.lexical.KvnLexicalAnalyzer.accept(KvnLexicalAnalyzer.java:160)
at org.orekit.files.ccsds.utils.parsing.AbstractMessageParser.parseMessage(AbstractMessageParser.java:139)
at org.orekit.files.ccsds.ndm.odm.oem.OemParser.parse(OemParser.java:135)
at de.tau_tec.astro.orekit.OrekitHandler.(OrekitHandler.java:1450)
at de.tau_tec.astro.orekit.OrekitHandler.main(OrekitHandler.java:2112)


It looks like it’s a regression in Orekit 11, because I was able to successfully parse OEM files in Orekit 10.3, for instance in this example GitHub - GorgiAstro/iss-ccsds-oem: Read International Space Station OEM orbit files using Orekit

I managed to reproduce your issue (iss-ccsds-oem/01-iss_ccsds_oem_read.ipynb at port-orekit-11 · GorgiAstro/iss-ccsds-oem · GitHub) but I am not able to find where in the Orekit source code the issue comes from though.


Could you try applying the following patch?
If it works, could someone commit it as well as a unit test for it (I’m sorry I do not have much time yet).ccsds.patch (1.5 KB)

i can confirm, that after applying this patch, parsing works for both the txt and xml file.
Thank you very much for your quick response!

Hi @M-V

Could you open an issue in our GitLab repository in order to classify and properly fix the bug?

Thank you very much,

I opened a ticket as advised: Issue 875
Thank you very much for your help!