Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly format and safely escape to CSV in DecodeEventLogger #1092

Merged
merged 8 commits into from Nov 15, 2021

Conversation

f3ndot
Copy link
Contributor

@f3ndot f3ndot commented Oct 17, 2021

Fixes #1038.

Hand-crafting a serialized format will always be a losing proposition. Brings in Apache's Commons CSV to provide a bulletproof CSV-formatted string to be written into the log. This has an additional benefit of making aliases and details safe to use quotes and commas (as well as other "reserved" CSV characters).

To preserve the existing behaviour of SDR Trunk's CSV logging, every value/cell is wrapped in quotes, even if it isn't explicitly needed.

Adds tests to ensure the strings are as we expect.

Allows us to control exactly how we want to format a CSV-valid row.
Instead of using a stream map, opting for an explicit handling so the logger can explode when an unexpected null shows up. Prevents the situation where things are mysteriously blank, forcing developers to handle known null scenarios.
Copy link
Owner

@DSheirer DSheirer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good.

Could you please resolve merge conflicts with the (master-branch) build.gradle file and I'll merge this?

Thanks!

@f3ndot
Copy link
Contributor Author

f3ndot commented Nov 14, 2021

@DSheirer welcome back, hope you're feeling rested and well.

Master merged in, builds and tests pass

@DSheirer DSheirer merged commit cb83a8e into DSheirer:master Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Call events log is missing a quote character, outputting malformed csv
2 participants