Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.20.2
-
None
-
Windows 7
-
Patch Available
-
Moderate
-
Patch
Description
Dear all,
When marshaling, Bindy doesn't quote headers in CSV files. This is problematic in the case where headers contain the separator character. When unmarshaling this is no issue, as `skipFirstLine=true`.
Unfortunately, changing the header is not an option in my case.
Please find attached:
- A sample CsvRecord-annotated bean `WickedCsv.java`, and
- a JUnit test `WickedCsvTest.java`
which allow to reproduce the issue.
The assertion error occurs in the last line of the `test()` method:
`assertEquals(csv.trim(), result.trim())`
I have attached a patch for BindyCsvFactory (`BindyCsvFactory.patch`), which fixes the issue. I copied and adjusted the lines according to the quote handling in `org.apache.camel.dataformat.bindy.BindyCsvFactory#bind`.
Would you please check?
Thank you.
Kind regards,
Clemens