Skip to content

Reading null Date #26

@zdrhic

Description

@zdrhic

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 ;-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions