I've created a table containing various data columns as well as a calculated numeric field. The calculated field depends on values in another field, which may sometimes be null, leading the result of the formula to be null as well. When I try to iterate over the rows of the table in question, Jackcess crashes with a BufferUnderflowException:
Exception in thread "main" java.nio.BufferUnderflowException
at java.nio.Buffer.nextGetIndex(Buffer.java:506)
at java.nio.HeapByteBuffer.getDouble(HeapByteBuffer.java:514)
at com.healthmarketscience.jackcess.impl.ColumnImpl.read(ColumnImpl.java:607)
at com.healthmarketscience.jackcess.impl.CalculatedColumnUtil$CalcColImpl.read(CalculatedColumnUtil.java:142)
at com.healthmarketscience.jackcess.impl.ColumnImpl.read(ColumnImpl.java:584)
at com.healthmarketscience.jackcess.impl.TableImpl.getRowColumn(TableImpl.java:766)
at com.healthmarketscience.jackcess.impl.TableImpl.getRow(TableImpl.java:672)
at com.healthmarketscience.jackcess.impl.TableImpl.getRow(TableImpl.java:652)
at com.healthmarketscience.jackcess.impl.CursorImpl.getCurrentRow(CursorImpl.java:699)
at com.healthmarketscience.jackcess.impl.CursorImpl$BaseIterator.next(CursorImpl.java:822)
at com.healthmarketscience.jackcess.impl.CursorImpl$BaseIterator.next(CursorImpl.java:779)
at com.sieuferd.harness.AccessImportDriver1.importTable(AccessImportDriver1.java:151)
at com.sieuferd.harness.AccessImportDriver1.importDatabase(AccessImportDriver1.java:58)
at com.sieuferd.harness.AccessImportDriver1.main(AccessImportDriver1.java:51)
The code that generated the exception above can be seen at https://gist.github.com/eirikbakke/7b303a8c2a0b7c62d0f6 (I can simplify the example further if desired). I've attached the example Access file used to produce the error above. The file was created in Microsoft Access 2013. I'm using Jackcess 2.1.1 on Java 1.8.0_31 for MacOS.
If the two rows containing nulls in the calculated fields are removed, then the error does not occur.
Note that the error occurs regardless of whether the client code actually asks for the value in the calculated field or not.
(Thanks for making and maintaining this great library! There's a ton of data locked up in old MS Access files...)
fixed in trunk, will be in the 2.1.2 release.
Awesome! Thanks again for providing this great library.