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

Bindy CSV separator not treated as regex but fixed character in all cases

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.16.1
    • 2.15.6, 2.16.3, 2.17.0
    • camel-bindy
    • None
    • Novice

    Description

      In the camel-bindy documentation (http://camel.apache.org/bindy.html) it says that the @CsvRecord separator parameter is interpreted as a regex. While that does seem to be the case when the record is being parsed, it seems to be treated as a literal string when autospanLine is true.

      For example, if we have

      @CsvRecord(separator="\\s+", autospanLine=true)
      

      and we have defined three string @DataField fields, and we have a line of input like this:

           field1 field2 field3a field3b
      

      then the third field value will be

          "field3a\s+field3b"
      

      Looking at the code in BindyCsvDataFormat.java it seems that this is because in some cases the separator string is treated as a literal string, not a regex. For example, this also seems to be true in some cases in the unquoteTokens method.

      Attachments

        Activity

          People

            lb Luca Burgazzoli
            JonFields Jon Fields
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: