[ 
https://issues.apache.org/jira/browse/SANDBOX-406?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Emmanuel Bourg updated SANDBOX-406:
-----------------------------------

           Description: 
Behaviour:

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

Examplary CSV file:

{code}
some
# comment OK
line
# comment OK
value
# problematic comment
{code}

Excerpt of Java code:

{code:java}
   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();
   }
{code}

Used Maven Dependency:

{code:xml}
 <dependency>
    <groupId>org.apache.solr</groupId>
    <artifactId>solr-commons-csv</artifactId>
    <version>1.4.0</version>
 </dependency>
{code}


  was:
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>sol


    Remaining Estimate:     (was: 24h)
     Original Estimate:     (was: 24h)
    
> CSV Parser loops inifinitely if last line starts with a comment char
> --------------------------------------------------------------------
>
>                 Key: SANDBOX-406
>                 URL: https://issues.apache.org/jira/browse/SANDBOX-406
>             Project: Commons Sandbox
>          Issue Type: Bug
>          Components: CSV
>            Reporter: Edgar Philipp
>
> Behaviour:
> Whenever the last non-empty line of the CSV file starts with a comment, the 
> CSVParser loops infinitely!
> Examplary CSV file:
> {code}
> some
> # comment OK
> line
> # comment OK
> value
> # problematic comment
> {code}
> Excerpt of Java code:
> {code:java}
>    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();
>    }
> {code}
> Used Maven Dependency:
> {code:xml}
>  <dependency>
>     <groupId>org.apache.solr</groupId>
>     <artifactId>solr-commons-csv</artifactId>
>     <version>1.4.0</version>
>  </dependency>
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to