When trying to store a biginteger using binstorage the following error is issued (The error might manifest elsewhere too):
java.lang.RuntimeException: Unexpected data type -1 found in stream
This is caused by a bug in the writeDatum method of the DataReaderWriter.java class. When writeDatum is called with a BigInteger as a argument, the BigInteger is converted to a byte and the writeDatum method is recursively called on the byte. writeDatum cannon handle byte objects but instead expects DataByteArray objects.
Suggested fix - wrap byte to DataByteArray:
change this line:
writeDatum(out, new DataByteArray(((BigInteger)val).toByteArray()));