binwiederhier/syncany — pull request #22 by pimotte (2014-01-18 11:01:35+00:00)
Title: Closing resources

I've been looking at all the sqlplayground branch and while familiarizing myself with it I noticed that PreparedStatements and ResultSets are hardly ever closed. While the javadoc suggests that those might be closed when the connection is, the internet (represented by stackoverflow: https://stackoverflow.com/questions/4507440/must-jdbc-resultsets-and-statements-be-closed-separately-although-the-connection) suggests that it is a good idea to close them just to be sure.

I followed the following rule: If the method throws SQLException I used close() at the appropriate time, if the method was try-catching, I used try-with-resources.

My main reason for actually implementing this are the "Cannot persist Database" errors I keep getting with various tests, but this does not seem to fix that issue. (Since this is a work in progress and I saw some commit log about weirdly undeterministic failing tests, I take you are aware of this. If not, let me know and I can get some stacktraces to you.)