Spring Batch - FlatFileParseException (record with double quotes)

左心房为你撑大大i 提交于 2021-02-08 07:40:48

问题


I have few records with double quotes in between the field values.

So When i use FlatFileItemReader it throws FlatFileParseException for those records.

The Sample Record is:

7^A3989815^A2400284298^ABU^AA" - CLEANING INC.^A$

How do we handle this kind of records in Spring Batch Item Readers?

Regards, Shankar


回答1:


You can change default quote character to something which you are sure will not appear as suggested here. We had similar problems and changed it to @ as suggested and it works, but that gives potentially new problem, if @ appears it will break.

Other solution would be to override DelimitedLineTokenizer and to always return false from method isQuoteCharacter as proposed here which is better solution IMO.



来源:https://stackoverflow.com/questions/29099559/spring-batch-flatfileparseexception-record-with-double-quotes

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!