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.
917 stars 252 forks source link

Incorrect behavior for trimValues(false) in fixed-width parsing #496

Open battmush opened 2 years ago

battmush commented 2 years ago

Release 2.9.1

Performing a fixed-width parse with trimValues(false) enabled on the settings object is not producing advertised behavior, and is returning a null String object rather than the untrimmed value for fields containing only whitespace. This behavior is seen with the following settings options present:

setLineSeparator("\n");
setSkipTrailingCharsUntilNewline(true);
settings.trimValues(false);

We prefer not to use setNullValue("") as that removes our ability to determine if the line is malformed, not providing enough data to satisfy all field width requirements.