Yesterday I detected a new kind of Exception,
a mysterious NullPointer.
The Exception raised in teh follwoing code line; the line just says: update a account based on some parameters passed, and return the id.:
long id = updateAccount(
I checked all parameters passed, but all of them where valid (and checked elsewhere).
But the problem wasnt the parameters, it was the return value. The function getId actually returns a Long, not a long: if the returned value is null, the autounboxing mechanism of java throws the NullPointer.
This kind of error is quite hard to detect, especially when you are passing dereferenced parameters to the function.
A special kind of Exception, say a “AutoUnboxingException” would make the debugging much easier.