Menu

#1472 Unnecessary exception when ResultSet is closed before Statement

SQuirreL
closed-fixed
nobody
None
medium
2021-05-05
2021-05-04
Chris B
No

Please have a look at closeResultSet(ResultSet, boolean) in class net.sourceforge.squirrel_sql.fw.sql.SQLUtilities:

The ResultSet rs is closed first.
Afterwards the method tries to get and close the Statement:

Statement stmt = rs.getStatement();
if (stmt != null)
{
  stmt.close();
}

I think this is predetermined to fail and to produce unnecessary exceptions.
The Java API docs say about getStatement() in class ResultSet:
"Throws: SQLException - if a database access error occurs or this method is called on a closed result set"

So I guess it would be the better order to close the Statement first and the ResultSet afterwards.

Discussion

  • Gerd Wagner

    Gerd Wagner - 2021-05-05
    • status: open --> closed-fixed
     
  • Gerd Wagner

    Gerd Wagner - 2021-05-05

    Fixed in out GIT repository. Will be available in future snapshots and versions.

     

Log in to post a comment.

MongoDB Logo MongoDB