I was attempting to parse a file which, as near as I can tell, contained a lineSeparator on the last line before the file ended. This causes LinePushbackReader to read the line up to the separator, but it doesn't realize that it's reached the end-of-file. Parsing such a file with any simple, valid LineFormat object will fail with an exception similar to this:
org.sadun.text.ffp.FormatOutOfRangeException: Expected type (from position 4 to position10, length 6, type alphanumeric), out of range in line 'null' (4 characters long)
at org.sadun.text.ffp.LineFormat.parse(LineFormat.java:1180)
at org.sadun.text.ffp.FlatFileParser.parse(FlatFileParser.java:400)
...
(SourceForge won't let me attach the file, ~ 300K)
In my opinion the problem lies in FlatFileParser; when it calls readLine() on LinePushbackReader, it doesn't do a check to see if the result is null. Adding a null check fixes the problem. The patch which fixes the issue is attached.
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"