bodewig 2004/11/12 01:44:08 Modified: src/main/org/apache/tools/ant/taskdefs SQLExec.java Log: Restore old method signature (BWC) and plug a ResultSet leak at the same time Revision Changes Path 1.69 +24 -1 ant/src/main/org/apache/tools/ant/taskdefs/SQLExec.java Index: SQLExec.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/SQLExec.java,v retrieving revision 1.68 retrieving revision 1.69 diff -u -r1.68 -r1.69 --- SQLExec.java 11 Nov 2004 18:46:36 -0000 1.68 +++ SQLExec.java 12 Nov 2004 09:44:08 -0000 1.69 @@ -509,13 +509,13 @@ return; } + ResultSet resultSet = null; try { totalSql++; log("SQL: " + sql, Project.MSG_VERBOSE); boolean ret; int updateCount = 0, updateCountTotal = 0; - ResultSet resultSet = null; ret = statement.execute(sql); updateCount = statement.getUpdateCount(); @@ -559,6 +559,28 @@ throw e; } log(e.toString(), Project.MSG_ERR); + } finally { + if (resultSet != null) { + resultSet.close(); + } + } + } + + /** + * print any results in the statement + * @deprecated use [EMAIL PROTECTED] #printResults(java.sql.ResultSet, java.io.PrintStream) the two arg version} instead. + * @param out the place to print results + * @throws SQLException on SQL problems. + */ + protected void printResults(PrintStream out) throws SQLException { + ResultSet rs = null; + rs = statement.getResultSet(); + try { + printResults(rs, out); + } finally { + if (rs != null) { + rs.close(); + } } } @@ -567,6 +589,7 @@ * @param rs the resultset to print information about * @param out the place to print results * @throws SQLException on SQL problems. + * @since Ant 1.7 */ protected void printResults(ResultSet rs, PrintStream out) throws SQLException { if (rs != null) {
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]