Uploaded image for project: 'Commons CSV'
  1. Commons CSV
  2. CSV-162

Two qoute characters in a row cause error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 1.2
    • None
    • Parser
    • None
    • Windows 7 x64
      Java8

    Description

      Hello!
      I've recently noticed a some bug, I think. I have the following csv file:

      DATA_SERVICE_ID,""DATA_SPEED_APID"",COMPONENT_ID,SPEED,SYNCHRONOUS
      2120000,""1596"",4240000,9600,true

      (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:

      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)

      Attachments

        Activity

          People

            Unassigned Unassigned
            ankulikov Andrey Kulikov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: