If map-empty-string
is disabled, then the value passed to the cell processors should be null
(i.e. you'd most likely get an error from the processor for that column saying the value shouldn't be null - not an exception about there being the wrong number of processors). If you could post the exception details to clarify this that would be great :)
After running some tests with CsvDozerBeanWriter
, it looks like the Dozer mapping API was fixed in Dozer 5.4.0 (see this commit).
In Dozer 5.3.2
""
is mapped tonull
In Dozer 5.4.0
""
is mapped to""
Unfortunately there's no detailed release notes for Dozer 5.4.0 (and no issue created on GitHub - they're still in the process of being migrated from SourceForge) to make this easier to find out.
If you can upgrade to Dozer 5.4.0, then that should fix your problem. I'm planning on upgrading Super CSV to Dozer 5.4.0 in the next release (early next year), but there's nothing stopping you from overriding the version inherited from Super CSV right now.
If you're stuck on Dozer 5.3.2 for some reason, then I'd suggest you either:
write your own Writer that extends
CsvDozerBeanWriter
(but override theconfigureBeanMapping()
method to provide aMappingBuilder
that hasmap-empty-string
enabled)use
CsvBeanWriter
(if you're not using indexed/deep mapping)
FYI I encountered another bug with the mapping API in 5.3.2 that meant I had to enable map-null
at the class level instead of the mapping level when writing CsvDozerBeanWriter
- this has also been fixed in 5.4.0 (though Super CSV will function correctly with either version of Dozer).