Why Methods Should Check Their Arguments
Tuesday, June 13th, 2006I’ve probably wasted two hours over the last couple of days trying to debug this line of code:
private static final QName name = new QName("valid-isbn", "http://www.example.org/books");
Do you see the bug? I’ve made it even easier to find by showing you just the line that contains the bug; but it still doesn’t jump out at you. Originally, of course, I didn’t know this was the buggy line. The exception was thrown somewhere completely different in the code base, but this is indeed the buggy line.
(more…)