#20 Opencsv parsing error

open
nobody
None
5
2011-09-01
2011-09-01
Anonymous
No

I use openCSV to parse a csv file that contains over 600000 records. It fails only on one record where the record is as follows (you can save the lines below in a csv file to test it)

"id","email","profile_id","first_name","last_name"
"475592","abc@yahoo.com","bc1cna22","\""CHia Sia Ta",""

Current implementation does not handle the first_name field's value.

public static List<UpakneeUserBean> parseCvSIntoBeans(String filePath )
throws FileNotFoundException {
CSVReader reader = new CSVReader(new FileReader(filePath));
HeaderColumnNameMappingStrategy<UserBean> strat = new HeaderColumnNameMappingStrategy<UserBean>();
strat.setType(UserBean.class);
CsvToBean<UserBean> csv = new CsvToBean<UserBean>();
return csv.parse(strat, reader);
}

Discussion

  •  
    Attachments