From: Thomas E. <els...@ho...> - 2008-05-10 13:21:37
|
Hello, I noticed that the current readLong() method of BlockIo, cannot correctly return a value larger than Integer.MAX_VALUE. At least not if the long is written with the corresponding writeLong() method of BlockIo. The below code simulates the issue: -------------------------------------------------------------------------------- public static void main(String[] args) { byte[] data = new byte[8]; long testLong = Integer.MAX_VALUE; testLong += 1; BlockIo block = new BlockIo(0, data); block.writeLong(0, testLong); long shouldBeSame = block.readLong(0); System.out.println("Written: " + testLong); System.out.println("Read: " + shouldBeSame); if (testLong != shouldBeSame) System.err.println("Warning! Written and read are not the same..."); else System.out.println("Success. They are the same..."); } -------------------------------------------------------------------------------- I use the latest source from the CVS by the way. I dont know if this is an issue at all, maybe the longs in BlockIo never gets above Integer.MAX_VALUE anyway. I just noticed it, because I used the same code for linking some logical row ids with eachother ( returned from RecordManager.insert() ), and got errors because some of the logical ids indeed gets above Integer.MAX_VALUE after a lot of inserts. The original riginal version of readLong() by Alex Boisvert works without problems in all cases. I just thought I would let you know. And thanks to everyone here for a great and usefull software. Best Regards, Thomas |