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

Camel Bindy @FixedLengthRecord cannot parse UTF-8 with multibyte characters

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 2.21.5
    • 3.x
    • camel-bindy
    • None
    • Unknown

    Description

      We are using Camel Bindy to parse fixed length data.

      I came across the issue, that it fails to read data containing characters like ß, which takes 2 bytes. The character set is properly set on the exchange to UTF-8, the record length is 1568 bytes, but since there are 2xß characters, it throws the error:

      Size of the record: 1566 is not equal to the value provided in the model: 1568, StackTrace: java.lang.IllegalArgumentException: Size of the record: 1566 is not equal to the value provided in the model: 1568Size of the record: 1566 is not equal to the value provided in the model: 1568, StackTrace: java.lang.IllegalArgumentException: Size of the record: 1566 is not equal to the value provided in the model: 1568 at org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat.createModel(BindyFixedLengthDataFormat.java:295)

      here:

      BindyFixedLengthDataFormat#createModel

      if ((myLine.length() < factory.recordLength()
       && !factory.isIgnoreMissingChars()) || (myLine.length() > factory.recordLength())) {
       throw new java.lang.IllegalArgumentException("Size of the record: " + myLine.length()
       + " is not equal to the value provided in the model: " + factory.recordLength());
      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            antidote2 Robert Half
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: