[
https://issues.apache.org/jira/browse/CAMEL-14085?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16957137#comment-16957137
]
Robert Half commented on CAMEL-14085:
-------------------------------------
Actually I saw in the debugger how it works. It reads the characters using a
Scanner object.
below myLine is a String, so the length is in characters, but imho the
recordLength I configure should be in bytes. If some character takes more than
a byte, we obviously will see the issue.
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());
}
> Camel Bindy @FixedLengthRecord cannot parse UTF-8 with multibyte characters
> ---------------------------------------------------------------------------
>
> Key: CAMEL-14085
> URL: https://issues.apache.org/jira/browse/CAMEL-14085
> Project: Camel
> Issue Type: Bug
> Components: camel-bindy
> Affects Versions: 2.21.5
> Reporter: Robert Half
> Priority: Major
> Fix For: 2.25.0, 3.x
>
>
> 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
> {code:java}
> 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());
> }{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)