Community
Participate
Working Groups
With the following method: public CachedRowSet executeQuery(Connection conn, String sqlStatement) throws SQLException { CachedRowSet result = null; Statement st = conn.createStatement(); try { result = new CachedRowSetImpl(); ResultSet resultSet = st.executeQuery(sqlStatement); try { result.populate(resultSet); } finally { resultSet.close(); resultSet = null; } } finally { st.close(); st = null; } return result; } the variable st in the line with executeQuery() is highlighted with the warning: "The variable st can only be null; it was either set to null or checked for null when last used". Clearly, this is not the case. I guess this is something to do with the finally block. Strange then, that the resultSet variable is not affected. If I delete the "st = null" line, the warning goes away, but the resultSet variable is still not highlighted.
*** This bug has been marked as a duplicate of 128962 ***