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

Parser iterates over the last CSV Record twice.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.4
    • Fix Version/s: 1.9.0
    • Component/s: Parser
    • Labels:
      None
    • Environment:

      Mac OS X 10.10.5

      Description

      class CSVParserSpecification extends Specification {
         def "TEst CSVParser"() {
            setup:
               URL url = new URL("https://....../csv_with_28_lines_header_plus_ 27_records");
               BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
               def CSVParser parser = CSVFormat.RFC4180.withFirstRecordAsHeader().withIgnoreEmptyLines().withTrim().parse(reader);
            when:
               def count = 0
               for (CSVRecord record: parser)
                  { println("Processing " + parser.getCurrentLineNumber()) count++ }
               println(count);
               parser.close()
            then:
               count == 27
         }
      }
      

        Attachments

        1. whitelist.csv
          2 kB
          Rodolfo Duldulao

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              rnduldulaojr@gmail.com Rodolfo Duldulao
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: