dbf
dbf copied to clipboard
Reading null Date
There are empty values in Date column in file I am trying to parse, your (in other cases very helpful library) is parsing them as some "extreme Date value" with year 17793. Is it possible to update library to parse them as null, which, I think, is expected meaning? File I am parsing can be downloaded from https://liehweb.financnasprava.sk/data/export/cisOLDDBF.zip in this zip it is Subjekt2.dbf file. This code snipet should reproduce it (first expected null value is in first record).
File file = new File("src/test/resources/Subjekt2.dbf");
try (DbfReader reader = new DbfReader(file)) {
Object[] row;
while ((row = reader.nextRecord()) != null) {
Date expectedNullDate = ((Date) row[11]); // <- extreme date parsed here
if(17000 < expectedNullDate.getYear()){ //workaround
expectedNullDate = null;
}
}
}
Don't hurry, my workaround is OK for some time ;-)