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

Parser iterates over the last CSV Record twice.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.4
    • 1.9.0
    • Parser
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: