Not really sure what explanations you are looking for David, I just clarified the javadoc comments for EmbedStatement.checkStatus and checkExecStatus based upon a few minutes of code inspection. Modifying the javadoc firms up the contract this method is exposing and thus the code in isClosed() is allowed to make assumptions
based upon that contract.
The checkExecStatus method only throws execeptions in two cases, one the statement is closed and two the statement is part of a non-active global transaction.
In either of those two cases and the no exception case after the execution the active field correctly represents the open state of the Statement.
One exception thrown is the NO_CURRENT_CONNECTION sql state, means either :
the Statement is open but in a suspended transaction (isClosed needs to return false)
the Statement has been closed implicitly due to its connection being closed and this is the first
call against the Statement that has noticed the connection has been closed. (isClosed needs to return true)
The other is ALREADY_CLOSED, means either :
the Statement has been explictly closed (isClosed needs to return true)
the Statement has been closed implicitly and a previous checkExecStatus threw a NO_CURRENT_CONNECTION (isClosed needs to return true)
Thus only catching NO_CURRENT_CONNECTION would be wrong as ALREADY_CLOSED is a valid exception that could occur
here and require isClosed() to return true. Thus we are left with needing to catch the two exceptions that this method can throw, which seems,
to me, to be the same as catching everything.