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.
915 stars 251 forks source link

null parsing results with leading `#` on FixedWidthParser #493

Closed rmalleman closed 2 years ago

rmalleman commented 2 years ago

FixedWidthParser.parseLine() is returning a null when there is a leading # on the line. This doesn't seem like intended behavior and I couldnt find anything in FixedWidthParserSettings that looks like it would fix it. Here is some scala code to reproduce it

    val fixedWidthFields = new FixedWidthFields(4)
    val parserSetting = new FixedWidthParserSettings(fixedWidthFields)
    val parsedLine = parser.parseLine("#ABC")
   assert(parsedLine == null)
battmush commented 2 years ago

It looks like it's treating the line as a comment. You can change the parser behavior by setting parserSetting.setCommentProcessingEnabled(false)

rmalleman commented 2 years ago

You're right, that did the trick. Still seems like strange behavior to return null, but that could be my scala bias showing.