commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrey Kulikov (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CSV-162) Two qoute characters in a row cause error
Date Wed, 11 Nov 2015 06:33:10 GMT
Andrey Kulikov created CSV-162:
----------------------------------

             Summary: Two qoute characters in a row cause error 
                 Key: CSV-162
                 URL: https://issues.apache.org/jira/browse/CSV-162
             Project: Commons CSV
          Issue Type: Bug
          Components: Parser
    Affects Versions: 1.2
         Environment: Windows 7 x64
Java8
            Reporter: Andrey Kulikov


Hello!
I've recently noticed a some bug, I think. I have the following csv file:
{quote}
 DATA_SERVICE_ID,""DATA_SPEED_APID"",COMPONENT_ID,SPEED,SYNCHRONOUS 
2120000,""1596"",4240000,9600,true
{quote}
(The first line is a header)

I'm trying to parse it via this configuration:
{{CSVFormat format = CSVFormat.newFormat(',').withQuote('"').withHeader();}}

*Expected result*: all headers and values without quotes
*Actual result*: {quote}Exception in thread "main" java.io.IOException: (line 1) invalid char
between encapsulated token and delimiter
	at org.apache.commons.csv.Lexer.parseEncapsulatedToken(Lexer.java:275)
	at org.apache.commons.csv.Lexer.nextToken(Lexer.java:152)
	at org.apache.commons.csv.CSVParser.nextRecord(CSVParser.java:498)
	at org.apache.commons.csv.CSVParser.initializeHeader(CSVParser.java:386)
	at org.apache.commons.csv.CSVParser.<init>(CSVParser.java:283)
	at org.apache.commons.csv.CSVParser.<init>(CSVParser.java:251)
	at Runner.main(Runner.java:20)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140){quote}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message