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

CSV Parser loops inifinitely if last line starts with a comment char

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: 1.0
    • Component/s: Parser
    • Labels:
      None

      Description

      Behaviour:

      Whenever the last non-empty line of the CSV file starts with a comment, the CSVParser loops infinitely!

      Examplary CSV file:

      some
      # comment OK
      line
      # comment OK
      value
      # problematic comment
      

      Excerpt of Java code:

         private static final char COMMENT = '#';
         private static final char QUOTE = '"';
         private static final char SEPARATOR = ';';
      
         CSVStrategy csvStrategy = new CSVStrategy(SEPARATOR, QUOTE, COMMENT);
         CSVParser parser = new CSVParser(reader, csvStrategy);
      
         String[] line = parser.getLine();
      
         while (line != null) {
            Log.debug("Line: " + line[0]);
            // Do something
            line = parser.getLine();
         }
      

      Used Maven Dependency:

       <dependency>
          <groupId>org.apache.solr</groupId>
          <artifactId>solr-commons-csv</artifactId>
          <version>1.4.0</version>
       </dependency>
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                edgarphilipp Edgar Philipp
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: