Exception handling in Java

No, this isn't yet another rant on checked vs non-checked exceptions. It's just a link to an excellent article on exception handling by Heinz Kabutz. Heinz drew me into reading the article with the very first sentence (which I completely agree with):

In my experience, all Java projects contain poorly written exception handling code.
He then shows how exception handling is not nearly as simple or straightforward as many developers think it is (which has lead some to prefer old-fashioned error-codes instead) and how the upcoming JDK 1.5 makes things a little bit easier by adding the Java version of .NET's Application.ThreadException / AppDomain.UnhandledException / HttpApplication.Error events (but don't worry, everything else in JDK 1.5 is completely original and in no way shape or form influenced by .NET... ;-)

If you're a serious Java developer, I highly recommend not only reading Heinz' article, but also subscribing to his newsletter. Unfortunately there's no RSS feed (the blue XML icons on the archive page have nothing to do with RSS) so good ol' email will have to do.

TrackBack URL for this entry: http://www.hutteman.com/scgi-bin/mt/mt-tb.cgi/142
Comments

SharpReader, my Love, my Hate ...
SharpReader, my Love, my Hate ...

Trackback from UnknownReference at June 1, 2004 12:31 PM

In my experience, all projects contain [some] poorly written code.

Posted by Zohar at June 5, 2004 2:08 PM

In Java 2 1.4 or lower, we can do like this: (catch clauses are omit for brevity)

boolean done = false;
try {
...
...
done = true;
} finally {
if (!done) {
con.rollback();
}
con.close();
}

Posted by Trustin Lee at June 12, 2004 10:27 PM
This discussion has been closed. If you wish to contact me about this post, you can do so by email.