Issue Details (XML | Word | Printable)

Key: DBUTILS-12
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: Mikhail Krivoshein
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Commons DbUtils

[dbutils] Protected QueryRunner.close() methods

Created: 04/Jun/04 08:56 PM   Updated: 02/Jan/08 07:29 AM
Return to search
Component/s: None
Affects Version/s: None
Fix Version/s: 1.1

Time Tracking:
Not Specified

Environment:
Operating System: All
Platform: All

Bugzilla Id: 29393


 Description  « Hide
Index: QueryRunner.java
===================================================================
RCS file:
/home/cvspublic/jakarta-commons/dbutils/src/java/org/apache/commons/dbutils/QueryRunner.java,v
retrieving revision 1.10
diff -u -r1.10 QueryRunner.java
— QueryRunner.java 15 Mar 2004 05:31:40 -0000 1.10
+++ QueryRunner.java 4 Jun 2004 13:54:04 -0000
@@ -20,6 +20,7 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
+import java.sql.Statement;
import java.sql.Types;
import java.util.Arrays;

@@ -86,7 +87,7 @@
} catch (SQLException e) { this.rethrow(e, sql, params); } finally { - DbUtils.close(stmt); + close(stmt); }

return rows;
@@ -111,7 +112,7 @@
try { return this.batch(conn, sql, params); } finally { - DbUtils.close(conn); + close(conn); }
}

@@ -222,9 +223,9 @@

} finally {
try { - DbUtils.close(rs); + close(rs); } finally { - DbUtils.close(stmt); + close(stmt); }
}

@@ -290,7 +291,7 @@
return this.query(conn, sql, params, rsh);

} finally {- DbUtils.close(conn);+ close(conn); } }
}

@@ -410,7 +411,7 @@
this.rethrow(e, sql, params);

} finally {- DbUtils.close(stmt);+ close(stmt); } }

return rows;
@@ -465,7 +466,7 @@
try { return this.update(conn, sql, params); } finally { - DbUtils.close(conn); + close(conn); }
}

@@ -493,5 +494,25 @@
protected ResultSet wrap(ResultSet rs) { return rs; }
-
+
+ /**
+ * Close a <code>Connection</code>, avoid closing if null.
+ */
+ protected void close(Connection conn) throws SQLException { + DbUtils.close(conn); + }
+
+ /**
+ * Close a <code>ResultSet</code>, avoid closing if null.
+ */
+ protected void close(ResultSet rs) throws SQLException { + DbUtils.close(rs); + }
+
+ /**
+ * Close a <code>Statement</code>, avoid closing if null.
+ */
+ protected void close(Statement stmt) throws SQLException { + DbUtils.close(stmt); + }
}



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Henri Yandell made changes - 16/May/06 09:41 AM
Field Original Value New Value
issue.field.bugzillaimportkey 29393 12341486
Henri Yandell made changes - 16/May/06 11:29 AM
Project Commons [ 12310458 ] Commons DbUtils [ 12310470 ]
Affects Version/s unspecified [ 12311647 ]
Assignee Jakarta Commons Developers Mailing List [ commons-dev@jakarta.apache.org ]
Key COM-1334 DBUTILS-12
Component/s DbUtils [ 12311110 ]
Henri Yandell made changes - 06/Jul/06 11:36 AM
Fix Version/s 1.1 [ 12311973 ]
Henri Yandell made changes - 02/Jan/08 07:29 AM
Status Resolved [ 5 ] Closed [ 6 ]