bayard 2003/03/10 10:04:45
Modified: dbutils/src/java/org/apache/commons/dbutils DbUtils.java
Log:
Adding in a closeQuietly(Connection, Statement, ResultSet) method.
Revision Changes Path
1.13 +11 -1
jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/DbUtils.java
Index: DbUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/DbUtils.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- DbUtils.java 9 Mar 2003 17:14:18 -0000 1.12
+++ DbUtils.java 10 Mar 2003 18:04:45 -0000 1.13
@@ -392,7 +392,7 @@
}
rs.close();
}
-
+
/**
* Close a connection, avoid closing if null and hide
* any exceptions that occur.
@@ -427,6 +427,16 @@
} catch (SQLException sqle) {
// quiet
}
+ }
+
+ /**
+ * Close a connection, statement and resultset, avoiding
+ * closing if null and hiding any exceptions that occur.
+ */
+ public static void closeQuietly(Connection conn, Statement stmt, ResultSet rs) {
+ closeQuietly(rs);
+ closeQuietly(stmt);
+ closeQuietly(conn);
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]