Code Monkey home page Code Monkey logo

dans-dbf-lib's People

Contributors

ekoi avatar hoshantm avatar janvanmansum avatar simoc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

dans-dbf-lib's Issues

Opening read only DBF file throws java.io.FileNotFoundException

If my DBF file has write permission then it is opened successfully. However, if my DBF file is read-only, then the method Table.open() throws an java.io.FileNotFoundException. For example,

$ ls -l /tmp/sample.dbf 
-r--r--r-- 1 simoc simoc 225 Feb 26 20:23 /tmp/sample.dbf

the following Java code:

Table t = new Table(new File("/tmp/sample.dbf"));
t.open();

results in:

java.io.FileNotFoundException: /tmp/sample.dbf (Permission denied)
at java.io.RandomAccessFile.open0(Native Method)
at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:243)
at nl.knaw.dans.common.dbflib.Table.open(Table.java:273)
at nl.knaw.dans.common.dbflib.Table.open(Table.java:257)
at nl.knaw.dans.common.dbflib.Runner4.main(Runner4.java:12)

NullPointerException reading DBF file opened without directory

If I open a DBF file using a bare filename without a directory, then reading from the file fails. My test program begins:

11  File dbfFile = new File("cars.dbf");
12  Table table = new Table(dbfFile);
13  table.open(IfNonExistent.ERROR);
14  List<Field> fields = table.getFields();
15  Iterator<Record> it = table.recordIterator();
16  while (it.hasNext())
17  {
18    Record record = it.next();

The exception is:

Exception in thread "main" java.lang.NullPointerException
at java.io.File.<init>(File.java:277)
at nl.knaw.dans.common.dbflib.Util.getMemoFile(Util.java:146)
at nl.knaw.dans.common.dbflib.Table.openMemo(Table.java:600)
at nl.knaw.dans.common.dbflib.Table.ensureMemoOpened(Table.java:570)
at nl.knaw.dans.common.dbflib.Table.readMemo(Table.java:552)
at nl.knaw.dans.common.dbflib.Table.getRecordAt(Table.java:698)
at nl.knaw.dans.common.dbflib.Table$RecordIterator.next(Table.java:105)
at nl.knaw.dans.common.dbflib.Table$RecordIterator.next(Table.java:44)
at DansDbfDemo.main(DansDbfDemo.java:18)

If I change the filename to ./cars.dbf then the program works correctly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.