Croway opened a new pull request, #24816:
URL: https://github.com/apache/camel/pull/24816
## Summary
_Claude Code on behalf of Croway_
Fixes two stacked bugs in `CsvDataFormat` that cause the `format` option
(e.g., `<csv format="MYSQL"/>`) to be silently ignored:
- **Dead guard:** The `csvFormat` field is eagerly initialized to
`CSVFormat.DEFAULT`, making the `doInit()` condition `if (csvFormat == null &&
format != null)` unreachable. Removed the `csvFormat == null` guard so the
`format` string is resolved when set via DSL/XML/YAML.
- **Name mismatch:** `CSVFormat.valueOf(format)` delegates to
`CSVFormat.Predefined.valueOf()` which uses CamelCase names (`Excel`,
`InformixUnload`) while Camel's model advertises uppercase names (`EXCEL`,
`INFORMIX_UNLOAD`). Replaced with a case-insensitive, underscore-stripped
lookup.
**Regression history:** Introduced in CAMEL-22354 (getter/setter alignment),
partially addressed in CAMEL-23031 (init ordering) but the dead guard and name
mismatch remained.
**Failure scenario:** `setFormat("MYSQL")` (which should produce
TAB-delimited output) silently produces comma-delimited DEFAULT output instead.
## Test plan
- [x] Added `shouldResolveFormatByName` — verifies `setFormat("MYSQL")`
produces TAB delimiter
- [x] Added `shouldResolveFormatByNameCaseInsensitive` — verifies
`setFormat("EXCEL")` resolves despite CamelCase enum mismatch
- [x] Existing Spring XML tests (`CsvMarshalAutogenColumnsSpringTest`,
`CsvMarshalAutogenColumnsSpringQuoteModeTest`) that use `format="EXCEL"` now
exercise the fix path and pass
- [x] Full `mvn verify` on `camel-csv` module passes (92 tests)
🤖 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]