commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Bourg (JIRA)" <>
Subject [jira] [Commented] (CSV-141) Some exceptions when CSV file has wrong format
Date Fri, 07 Nov 2014 08:12:34 GMT


Emmanuel Bourg commented on CSV-141:

Well, the main issue is the input which is malformed. We'll certainly evaluate if the parser
can be more tolerant in this case, but this won't happen overnight (patches are welcome of
course). In the meantime I suggest that you filter the CSV file on the server side before
handing it to the parser and add the missing quotes.

> Some exceptions when CSV file has wrong format
> ----------------------------------------------
>                 Key: CSV-141
>                 URL:
>             Project: Commons CSV
>          Issue Type: Bug
>          Components: Parser
>    Affects Versions: 1.0
>         Environment: Windows 7
> Eclipse ID for Java Developer, build id: 20130919-0819
> Java 7
>            Reporter: Nguyen Minh
> My java application has to handle thousands of CSV files uploaded by the client phones
everyday. So, there some CSV files have the wrong format which I'm not sure why.
> Here is my sample CSV. Microsoft Excel parses it correctly, but both Common CSV and OpenCSV
can't parse it. Open CSV can't parse line 2 (due to '\' character) and Common CSV will crash
on line 3 and 4:
> "1414770317901","android.widget.EditText","pass sem1 _84*|*","0","pass sem1 _8"
> "1414770318470","android.widget.EditText","pass sem1 _84:*|*","0","pass sem1 _84:\"
> "1414770318327","android.widget.EditText","pass sem1 
> "1414770318628","android.widget.EditText","pass sem1 _84*|*","0","pass sem1
> Line 3: (line 5) invalid char between encapsulated token and delimiter
> 	at org.apache.commons.csv.CSVParser$1.getNextRecord(
> 	at org.apache.commons.csv.CSVParser$1.hasNext(
> Line 4: (startline 5) EOF reached before encapsulated token finished
> 	at org.apache.commons.csv.CSVParser$1.getNextRecord(
> 	at org.apache.commons.csv.CSVParser$1.hasNext(

This message was sent by Atlassian JIRA

View raw message