ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Best Practices for Exception Handling
Subject:   Correction of the try/finally code
Date:   2008-01-21 01:00:38
From:   venkataramanam
Response to: Correction of the try/finally code

Roland, Well there is a problem with modified code as well. The intention of the author was "getConnection() throws an SQLException". And you have placed the call outside of try/catch. I would say, finally block should for non-nullness of connection variable 'conn' and then only close the connection.