postgresql-jdbc.git / summary / log / commit / refs
commit 6f0d85a58da55f50fcffc3d984fd0e97be7172f9
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Commit: Jeremy Whiting <jwhiting@redhat.com>
Date: Wed Nov 13 19:20:48 2013 +0000
Don't ignore the result of Statement.executeQuery().
Coverity thinks it's bad form.
org/postgresql/jdbc4/AbstractJdbc4Connection.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/org/postgresql/jdbc4/AbstractJdbc4Connection.java b/org/postgresql/jdbc4/AbstractJdbc4Connection.java
index 817e457b..3d7b0a54 100644
--- a/org/postgresql/jdbc4/AbstractJdbc4Connection.java
+++ b/org/postgresql/jdbc4/AbstractJdbc4Connection.java
@@ -121,12 +121,14 @@ abstract class AbstractJdbc4Connection extends org.postgresql.jdbc3g.AbstractJdb
throw new PSQLException(GT.tr("Invalid timeout ({0}<0).", timeout), PSQLState.INVALID_PARAMETER_VALUE);
}
boolean valid = false;
- Statement stmt = null;
+ Statement stmt = null;
+ ResultSet rs;
try {
if (!isClosed()) {
stmt = createStatement();
stmt.setQueryTimeout( timeout );
- stmt.executeQuery( "SELECT 1" );
+ rs = stmt.executeQuery( "SELECT 1" );
+ rs.close();
valid = true;
}
}
[parent: 72fd3b4b6e1d]