Link Details

Link 77927 thumbnail
User 111696 avatar

By bloid
via littletutorials.com
Published: Apr 28 2008 / 07:22

Dealing with exceptions is hard. For a while now in the Java world there are two camps. One considers the initial design of the Java exceptions system a sensible one, a feature that contributed greatly to Java’s success. A new camp has also formed in Java world and this new camp considers the original design fundamentally flawed and in dire need of rework.
  • 12
  • 1
  • 1145
  • 491

Comments

Add your comment
User 187417 avatar

sproketboy replied ago:

1 votes Vote down Vote up Reply

This is the comment I left on that blog.

I’ve thought recently that there should be a new JSR to move the general checked exceptions in Java to runtime exceptions. This is is because checked exceptions really should be Domain exceptions (InsufficientFundsException, CustomerNotFoundException, NoInventoryInStockException etc).

SQLException, IOException etc are really almost always runtime exceptions anyway and are the main pain-point IMO for checked exceptions in Java. These tend to need to be caught/tranlated/rethrown over and over again. And tend to pollute our domain objects.

User 240010 avatar

Nikita Ivanov replied ago:

0 votes Vote down Vote up Reply

It has always been beyond me how one can think that SQLException or IOException can be a runtime exception- essentially, not needed to be caught or handled, usually representing non-recoverable errors. Where one to begin think in this way?? How can anyone equate NPE with SQLException or IOException???

User 187417 avatar

sproketboy replied ago:

0 votes Vote down Vote up Reply

Right. Checked exceptions are for recoverable errors. You answered your own question.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.