I am using opencsv 2.3.
It handles parsing over 600,000 records in a csv file all fine except for the first record below:
"id","email","profile_id","first_name","last_name"
"475592","rbst218@yahoo.com","bc1er1163","\""CHia Sia Ta",""
"12345",''kazem.naderi@tt.com","bc234a","kazem","naderi"
It seems opencsv gets confused with the value of first_name (disymmetric double quotes at the beginnnig of the value)
You can save the above two lines in a file let's say badProfiles.csv and then using the code below try to parse the record. You will see that it cannot parse it correctly
public static List<UpakneeUserBean> parseCvSIntoBeans2(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);
}
I have attached the UserBean.java file to this bug report.
Thanks for your help
Scott Conway
None
None
Public
|
Date: 2011-09-28 10:13:28 PDT Hello, |
|
Date: 2011-09-08 10:35:11 PDT Hi, |
|
Date: 2011-09-07 17:03:26 PDT Ahh in that case the name should be "\\\"CHia Sia Ta". You can check out |
|
Date: 2011-09-07 10:49:26 PDT Hello, |
|
Date: 2011-09-05 20:49:51 PDT Please check out the latest trunk version (106) and in the Integration test |
|
Date: 2011-09-01 16:06:52 PDT I changed the priority because this error breaks our scheduled job to parse |
| Filename | Description | Download |
|---|---|---|
| UserBean.java | Download |
| Field | Old Value | Date | By |
|---|---|---|---|
| priority | 8 | 2011-09-28 10:13:28 PDT | kazemnaderi |
| assigned_to | nobody | 2011-09-07 10:49:26 PDT | kazemnaderi |
| priority | 5 | 2011-09-01 16:06:52 PDT | kazemnaderi |
| File Added | 422607: UserBean.java | 2011-09-01 16:02:31 PDT | kazemnaderi |