Think Log / 1 September 2026
2026-09-01
Today I fixed a bug I wrote 23 years ago.
Some code I wrote in 2003 was parsing an unsigned 64-bit integer using:
new BigInteger(bval)
Which interprets the byte array as a signed two’s-complement value.
It should have been:
new BigInteger(1, bval)
The bug survived for roughly 23 years.
And it turns out there were unit tests for the class.
They just didn’t cover that particular constructor.
Which is perhaps a more useful reminder than there being no tests at all.
Having tests and having coverage of the thing that’s broken are two very different things.
The tests passed.
For 23 years.
So did the bug.