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

Infinite loop when the last line is a comment

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • None
    • None
    • None
    • None
    • Linux ubuntu jaunty

    Description

      I try to parse a simple file bl.csv that contains:
      -----------------------------------
      #The simplest good test
      00000000
      0001
      0000002
      00003
      0000004
      #comment at the end
      ------------------------------------

      I wrote several test and I notice that when the last line is a comment , I get lock in an infinite loop when parsing the file.
      This is the only problem I notice, Others basic case work fine.

      Below is the parser I have configured:

      CSVStrategy strategy = CSVStrategy.DEFAULT_STRATEGY;
      strategy.setCommentStart('#');
      strategy.setIgnoreEmptyLines(true);
      strategy.setIgnoreLeadingWhitespaces(true);
      CSVParser csvparser = new CSVParser(new FileReader(csvFile), strategy);
      String[][] data = csvparser.getAllValues();

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              kboulebiar Kamel Boulebiar
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 4h
                  4h
                  Remaining:
                  Remaining Estimate - 4h
                  4h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified