dgraham 2004/09/03 06:14:07 Modified: dbutils/src/java/org/apache/commons/dbutils DbUtils.java dbutils/xdocs changes.xml Log: Added rollbackAndClose() and rollbackAndCloseQuietly() to DbUtils. Revision Changes Path 1.8 +28 -0 jakarta-commons/dbutils/src/java/org/apache/commons/dbutils/DbUtils.java Index: DbUtils.java =================================================================== RCS file: /home/cvs/jakarta-commons/dbutils/src/java/org/apache/commons/dbutils/DbUtils.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- DbUtils.java 3 Sep 2004 13:07:30 -0000 1.7 +++ DbUtils.java 3 Sep 2004 13:14:07 -0000 1.8 @@ -198,5 +198,33 @@ conn.rollback(); } } + + /** + * Performs a rollback on the <code>Connection</code> then closes it, + * avoid closing if null. + * @since DbUtils 1.1 + */ + public static void rollbackAndClose(Connection conn) throws SQLException { + if (conn != null) { + try { + conn.rollback(); + } finally { + conn.close(); + } + } + } + + /** + * Performs a rollback on the <code>Connection</code> then closes it, + * avoid closing if null and hide any SQLExceptions that occur. + * @since DbUtils 1.1 + */ + public static void rollbackAndCloseQuietly(Connection conn) { + try { + rollbackAndClose(conn); + } catch (SQLException e) { + // quiet + } + } } 1.5 +3 -0 jakarta-commons/dbutils/xdocs/changes.xml Index: changes.xml =================================================================== RCS file: /home/cvs/jakarta-commons/dbutils/xdocs/changes.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- changes.xml 23 Aug 2004 02:10:32 -0000 1.4 +++ changes.xml 3 Sep 2004 13:14:07 -0000 1.5 @@ -39,6 +39,9 @@ <body> <release version="1.1-dev" date="in CVS"> + <action dev="dgraham" type="add"> + Added DbUtils.rollbackAndClose() and DbUtils.rollbackAndCloseQuietly(). + </action> <action dev="dgraham" type="update"> Call ResultSet.getTimestamp() in BeanProcessor.processColumn() if the bean property is a java.sql.Timestamp. Oracle's getObject()
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]