Menu

#20 Opencsv parsing error

v1.0 (example)
closed
nobody
None
5
2016-04-27
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

  • Nobody/Anonymous

     
  • Andrew Rucker Jones

    • status: open --> closed
    • Group: --> v1.0 (example)
     
  • Andrew Rucker Jones

    Cleaning up old issues. If this still needs attention, please open a new ticket.

     

Log in to post a comment.