mekomsolutions / openmrs-module-initializer

The OpenMRS Initializer module is an API-only module that processes the content of the configuration folder when it is found inside OpenMRS' application data directory.
MIT License
23 stars 74 forks source link

CSV Parser should ignore blank lines at end of file #268

Open mogoodrich opened 2 months ago

mogoodrich commented 2 months ago

Minor annoyance/feature request, but if you have blank lines at the end of a csv file, the parser throws an exception saying it it unable to parse those lines. It would be nice if the the parser could just ignore those lines without errorring.

@Ruhanga @mseaton @rbuisson

mks-d commented 1 month ago

Something like this could be done after this block.

Or we could perhaps overload CSVReader#readNext().


I'm not sure anymore why things are how they are now, but it might have been more or less intentional actually, in order to detect blank lines here and there (including within the pack, not just at the end of the file) and encourage implementers to keep their CSV clean and tidy. Happy to change this though.

mseaton commented 1 month ago

We are already trimming and checking for empty values for each cell entry here. We could just retain a boolean indicating if any non-empty values were found for a row, and if not, return null.