Advertisement
Guest User

finally caveat

a guest
Sep 13th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. Connection conn = null;
  2. try {
  3. conn = openConnection();
  4. // do stuff
  5. exceprionThrower(); // throws SQLException()
  6. }
  7. finally {
  8. try {
  9. if (conn != null)
  10. conn.close();
  11. }
  12. catch(SomeException e) {} // nothing we can do
  13. // "swallow" SomeException exception so it doesnt get thrown out
  14. // the method throws SQLException() as expected
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement