uniVocity / univocity-parsers

uniVocity-parsers is a suite of extremely fast and reliable parsers for Java. It provides a consistent interface for handling different file formats, and a solid framework for the development of new parsers.
918 stars 251 forks source link

Invalid line number in collected comments #476

Open Tarun275 opened 3 years ago

Tarun275 commented 3 years ago

Issue: While collecting comments for below content, getting invalid line number. In below case, receiving 9 instead 10. line 10: # Look, a multi line value. And blank rows around it!

Issue at:

while ((record = parser.parseNextRecord()) != null) {
        long recordLine = parser.getContext().currentLine();
        Map<Long, String> comments = csvparser.getContext().comments();    // getting invalid line numbers for collected comments
}

Content: # This example was extracted from Wikipedia (en.wikipedia.org/wiki/Comma-separated_values) # # 2 double quotes ("") are used as the escape sequence for quoted fields, as per the RFC4180 standard #

Year,Make,Model,Description,Price 1997,Ford,E350,"ac, abs, moon",3000.00 1999,Chevy,"Venture ""Extended Edition""","",4900.00

# Look, a multi line value. And blank rows around it!

1996,Jeep,Grand Cherokee,"MUST SELL! air, moon roof, loaded",4799.00 1999,Chevy,"Venture ""Extended Edition, Very Large""",,5000.00 ,,"Venture ""Extended Edition""","",4900.00