allthingssecurity opened a new pull request, #28030:
URL: https://github.com/apache/camel/pull/28030

   # Description
   
   [CAMEL-25722](https://issues.apache.org/jira/browse/CAMEL-25722)
   
   `FlatpackDataFormat.marshal` writes the header line with `printHeader()` and 
then skips the first map of the `List<Map<String, Object>>` body when 
`ignoreFirstRecord` is true, which is the default. The header line does not 
come from that map (the column names are the keys of the first map, or the 
pzmap definition), so the skipped map is a data row: `[{ID=1, NAME=alice}, 
{ID=2, NAME=bob}]` is written as `ID,NAME` / `2,bob`, without a log. Unmarshal 
returns the records without the header line, so unmarshal followed by marshal 
loses the first record of every file. CAMEL-24170 listed this as item M18; the 
umbrella was resolved without a Flatpack change.
   
   Change: marshal writes every map of the list. `ignoreFirstRecord` keeps its 
documented meaning ("the first line is ignored ... for the column headers") for 
unmarshal. The header line is written as before.
   
   What users can notice: the first data row is now in the output. A route that 
added a dummy first map to work around this gets that map in the output too; a 
note is added to the 4.24 upgrade guide.
   
   Tests:
   - New `FlatpackMarshalKeepsFirstRowTest` (3 tests): default data format with 
2 maps; data format with the `INVENTORY-Delimited.pzmap.xml` definition; 
unmarshal of 3 records then marshal.
   - Without the change: 3 run, 3 failures (`expected: <[ID,NAME, 1,alice, 
2,bob]> but was: <[ID,NAME, 2,bob]>`, `expected: <3> but was: <2>`, `but was: 
<[ID,NAME, 2,bob, 3,carol]>`).
   - With the change the camel-flatpack tests pass: 41 run, 0 failures, 0 
errors, 0 skipped (38 existing and the 3 new ones).
   
   What is not changed: unmarshal, the header and footer handling, the 
`flatpack:` endpoint. `FlatpackFixedLengthDataFormatTest` sets 
`ignoreFirstRecord=false` for marshal and is not affected.
   
   What was not run: the full root build.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it): 
[CAMEL-25722](https://issues.apache.org/jira/browse/CAMEL-25722).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [ ] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
     (I built and tested camel-flatpack, including the formatter and 
import-sort plugins. I did not run the full root build.)
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
     This PR was prepared with Claude Code (Claude Opus 5.5). The commit 
carries a `Co-Authored-By` trailer.
   
   _Claude Code on behalf of allthingssecurity_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to