davsclaus opened a new pull request, #24952:
URL: https://github.com/apache/camel/pull/24952
## Summary
_Claude Code on behalf of davsclaus_
Fixes two issues from the CAMEL-24170 data format review in
`camel-univocity-parsers`:
- **H9 — ThreadLocal header cross-thread NPE:** `HeaderRowProcessor` stores
headers in a `static ThreadLocal`. When `lazyLoad=true` and `asMap=true`, the
lazy `MapRowIterator` is returned as the exchange body. If consumed on a
different thread (parallel split, seda, kafka), `getHeaders()` reads from the
wrong ThreadLocal slot and returns null, causing an NPE. Fixed by capturing
headers eagerly in `MapRowIterator`'s constructor (on the parsing thread) as a
`final String[]` field.
- **H10 — Closeable iterator:** `RowIterator` now implements `Closeable`
with `close()` calling `parser.stopParsing()`, enabling callers to explicitly
release the underlying input stream. Added a documentation note about the
lazy-load resource management contract.
## Test plan
- [x] New `UniVocityCsvLazyLoadAsMapTest` with 3 tests:
- `shouldUnmarshalLazyAsMap` — lazy + asMap on same thread
- `shouldUnmarshalLazyAsMapOnDifferentThread` — lazy + asMap consumed via
seda (cross-thread, validates H9 fix)
- `shouldCloseIteratorOnCompletion` — verifies iterator implements
Closeable
- [x] All 118 existing univocity-parsers tests pass
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude Opus 4.6 <[email protected]>
--
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]