Claus Ibsen created CAMEL-27825:
-----------------------------------

             Summary: camel-flatpack: allowShortLines/ignoreExtraColumns hide 
all parse warnings, and the data format ignores them for delimited data without 
a definition
                 Key: CAMEL-27825
                 URL: https://issues.apache.org/jira/browse/CAMEL-27825
             Project: Camel
          Issue Type: Bug
          Components: camel-flatpack
            Reporter: Claus Ibsen
             Fix For: 4.25.0


Found while improving the option descriptions of camel-flatpack for CAMEL-23832 
(pull request https://github.com/apache/camel/pull/31141).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. The data format ignores allowShortLines and ignoreExtraColumns for 
delimited data without a definition
{{FlatpackDataFormat.createParser}} returns the parser for delimited data 
without a definition before it applies allowShortLines and ignoreExtraColumns, 
so both options do nothing there. The endpoint applies them in both branches.
Proposed change: apply the two setters in the no-definition branch too.

h4. 2. allowShortLines and ignoreExtraColumns hide every parse warning
{{FlatpackEndpoint.createFixedParser}} / {{createDelimitedParser}} also call 
setIgnoreParseWarnings(true) for these options. That hides every FlatPack 
level-1 warning, such as "Odd number of Qualifier characters", so such a line 
is dropped without failing the producer, while without the options it fails.
Proposed change: do not set ignoreParseWarnings, and fail in FlatpackProducer 
only on errors with errorLevel > 1.

h4. 3. The fixed-length mapping is read with the JVM default charset
{{FlatpackEndpoint.createFixedParser}} reads the mapping with new 
InputStreamReader(is); the delimited path uses the exchange charset.
Proposed change: use one explicit charset (the mapping is XML).

h4. 4. The body reader leaks for delimited data when the mapping is missing
{{FlatpackEndpoint.createParser}} closes the body reader on failure only for 
fixed-length; for delimited the reader opened in createDelimitedParser leaks 
when the mapping resource is not found.
Proposed change: close it in both cases.

h4. 5. The data format drops lines with parse errors without notice
The unmarshal never checks the DataSet errors; lines with parse errors are left 
out of the DataSetList. DelimitedErrorWithUnmarshalTest expects this, so it may 
be deliberate, but the producer fails instead.
Proposed change: decide on one behavior, or add an option.


_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to