This code matches the bug pattern, but I believe is a false positive:
String status = null;
String sql = ...
PreparedStatement ps = null;
try {
ps = conn.getPreparedStatement(sql);
ps.setString(1, id);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
status = rs.getString(1);
}
}
catch (Exception e) {
e.printStackTrace();
}
finally {
if (ps != null) {
try {
ps.close();
} catch (SQLException ex) {
ex.printStackTrace();
}
}
}
return status;
The java.sql.Statment docs for close() indicate that closing a statement will also close its current ResultSet.
Regards-
--
Paul Morken
May be related: "All execution methods in the Statement interface implicitly close a statment's current ResultSet object if an open one exists."
It is still happening :/