brianm/jdbi — pull request #121 by pmaury (2014-11-18 21:36:05+00:00)
Title: fix masked exception in on-demand sqlobject

When using on-demand sqlobject, two exceptions may be thrown:
- the first one during the execution of the SQL
- the second one when the connection is closed

When this happens, the first exception is lost.

I discovered this problem because of network errors. During the SQL execution, I get (for example) a socket read timeout. Afterwards, closing the connection will also throws an exception. In this case, the exception is misleading, and I did not immediately understood the underlying problem.

It would be simple to fix with Java7. Here with Java6, the code is dreadful. If you can think of a more elegant solution, I would be happy to fix my code!