My buddy told me today that some programmers transform a checked exception (e.g. EJBException, SQLException...) to an unchecked (RuntimeException?)

My buddy explained a call stack where if you change the bottom of the stack you would have to change every method that calls it if you change the bottom (innermost) method.

Can you elaborate and/or examplify with code more in detail or did I misunderstand something? I don't think that I have had that problem since I never wrote throws.


Many programs have a top-level global exception handler which catches and logs all unexpected and uncaught exceptions. This means all uncaught unchecked exceptions are logged uniformly.

In this scenario, when faced with a Checked Exception which you cannot deal with or do not expect to ever occur, your easiest way of dealing with it is to simply throw new RuntimeException(ex);, because if you did throw ex; your method would have to declare it (void foo() throws SQLException), and any other methods which called it and didn't catch the exception would also need this declaration.

Not the answer you're looking for? Browse other questions tagged or ask your own question.