+1 to Alex and an improvement for Java 6: you could eliminate the
null
check in thefinally
block if you move theDerbyDog.getResultSet
call before thetry
block. If it's inside thetry
block and it throws an exception you won't be able toclose
theResultSet
because the reference will remainnull
. Guideline 1-2: Release resources in all cases in the Secure Coding Guidelines for the Java Programming Language, Version 4.0 documentation could be helpful.The
catch
block is unnecessary here. Exceptions will be propagated without it.Be aware of static helper classes.
DerbyDog
seems one of them. You might find my former answer about itmy former answer about it useful.
ResultSet resultSet = DerbyDog.getResultSet(strSelect);
try {
if (resultSet.next()) {
resultSet.updateString(COLUMN_STATUS, strStatus);
resultSet.updateRow();
}
} finally {
resultSet.close();
}