[libpostgresql-jdbc-java] 03/93: Don't ignore the result of Statement.executeQuery().

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Mon Jan 9 10:18:46 UTC 2017


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to annotated tag REL9_3_1102
in repository libpostgresql-jdbc-java.

commit eb8d050a549176336530a5a5c4c2aeb097e14529
Author: Heikki Linnakangas <heikki.linnakangas at iki.fi>
Date:   Wed Nov 13 21:20:48 2013 +0200

    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 817e457..3d7b0a5 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;
     	    }
     	}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libpostgresql-jdbc-java.git



More information about the pkg-java-commits mailing list