Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading null Date #26

Open
zdrhic opened this issue Aug 8, 2018 · 0 comments
Open

Reading null Date #26

zdrhic opened this issue Aug 8, 2018 · 0 comments

Comments

@zdrhic
Copy link

zdrhic commented Aug 8, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant