Closed saiar closed 5 years ago
Thanks for the report will have a look
Sure. Thanks!
On Wed, Jun 5, 2019 at 2:11 AM Arnaud Roger notifications@github.com wrote:
Thanks for the report will have a look
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/arnaudroger/SimpleFlatMapper/issues/657?email_source=notifications&email_token=AEH655ZR63CHVZFCBPM3MODPY3HPLA5CNFSM4HS7EOW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODW5Z7OA#issuecomment-498835384, or mute the thread https://github.com/notifications/unsubscribe-auth/AEH6552K4ZQR7LA64YFRX23PY3HPLANCNFSM4HS7EOWQ .
Hi,
While going through the code I found that there is something called as
ErrorCollectingMapper
inCsvMapperFactory.java
.I find that this behaves differently when compared to the standard mapper that we get by calling
CsvMapperFactory.newMapper(...)
when it comes toLocalDate
. While this mapper seems to take theCsvMapperFactory.defaultDateFormat(...)
into consideration while parsing dates, the ErrorCollectingMapper doesn't use it and relies on the default defined within the factory, which happens to be ""yyyy-MM-dd HH:mm:ss".CsvMapperFactory .newInstance() .defaultDateFormat("yyyy-MM-dd") .newMapper(MyObject.class);
works fine, but:CsvMapperFactory .newInstance() .defaultDateFormat("yyyy-MM-dd") .newErrorCollectingMapper(MyObject.class);
doesn't.I found that there is a related issue here.
I was able to use the fix suggested in that thread, which was to use it as follows:
CsvMapperFactory .newInstance() .addColumnProperty("scheduled_date", new DateFormatProperty("yyyy-MM-dd")) .newErrorCollectingMapper(MyObject.class);