Claus Ibsen created CAMEL-26128:
-----------------------------------

             Summary: camel-flatpack - with splitRows a List body in the route 
drops the remaining rows silently, and an exception in the consumer route is 
lost
                 Key: CAMEL-26128
                 URL: https://issues.apache.org/jira/browse/CAMEL-26128
             Project: Camel
          Issue Type: Bug
          Components: camel-flatpack
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while adding the catalog body types of stax, fop, flatpack and dfdl 
(CAMEL-24961, PR #28417).

h4. 1. An exception in the consumer route is lost

{{FlatpackEndpoint.processDataSet}} (main 2a465aa4814c, lines 105-111) sends 
each row on a correlated copy of the exchange and does not copy back an 
exception of the consumer route, so the producer's exchange completes normally 
when the route that handles the rows fails. Checked on 4.24.0-SNAPSHOT 
in-process.

Proposed: propagate the exception of the row exchange to the original exchange.

h4. 2. With splitRows every row exchange shares one DataSet cursor

With {{splitRows=true}} (the default) the producer loops {{while 
(dataSet.next())}} ({{FlatpackProducer}}, main 2a465aa4814c, line 46) and every 
row exchange gets the same {{DataSet}} object. {{getBody(List.class)}} in the 
route ({{FlatpackConverter.toList}}, line 55) moves that cursor to the end, so 
only row 0 is delivered and the other rows are dropped silently. Handing the 
rows to {{seda:}} makes {{getBody(Map.class)}} fail on every row with a 
NullPointerException "currentRecord is null" as the cursor has moved on. 
Checked on 4.24.0-SNAPSHOT in-process with a 3-row input.

Proposed: give each row exchange its own row (a Map or a Record of that row) 
instead of the shared DataSet.

h4. 3. getBody(Map) fails with a NullPointerException with splitRows=false or 
an empty input

With {{splitRows=false}} (or an input with no rows) the body is a DataSet whose 
cursor is not on a row, and {{FlatpackConverter.toMap}} (main 2a465aa4814c, 
line 43) fails with a NullPointerException. Checked on 4.24.0-SNAPSHOT 
in-process.

Proposed: fail with a clear error, or convert the first row (or nothing) when 
the cursor is not on a row.

h4. 4. A java.io.File or Path body fails

The producer reads the body with {{getMandatoryBody(Reader.class)}} 
({{FlatpackEndpoint}}, main 2a465aa4814c, lines 117 and 145), and only a File 
to BufferedReader converter exists, so a {{java.io.File}} or 
{{java.nio.file.Path}} body fails with no type conversion. Checked on 
4.24.0-SNAPSHOT in-process.

Proposed: read File and Path bodies through an InputStream (or add the 
converters).

_Claude Code on behalf of davsclaus_



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

Reply via email to