Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-12394

Camel Bindy: marshal doesn't quote headers

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.20.2
    • 2.20.3, 2.21.1, 2.22.0
    • camel-bindy
    • 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

      Attachments

        1. BindyCsvFactory.patch
          1 kB
          Clemens Blamauer
        2. WickedCsv.java
          1 kB
          Clemens Blamauer
        3. WickedCsvTest.java
          2 kB
          Clemens Blamauer

        Activity

          People

            davsclaus Claus Ibsen
            clemens.blamauer@gmail.com Clemens Blamauer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: