I have this code that does JDBC:
public void doMe() throws SQLException {
try {
... JDBC stuff
} finally {
try {
closeConnectionsAndStuff();
} catch (Exception e) {
logger.error(e);
throw e;
}
}
}
Why does this compile? I clearly catch Exception (it's probably a SQLException but caught as an Exception none the less) and I clearly throw it.
Why will it compile without havening throws Exception as part of the method declaration?
What makes is different from this:
public void doMe() {
throw new Exception()
}
this, of course does not compile, but I do not see the difference.