// typical debugging code that prints a message if thing is null.
ensureNotNull( thing, "thing" );

// in JDK 1.4+ you can also do that with an assert.
assert thing != null : "thing is null";