diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 9ca02b14a..c760814ca 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -52,6 +52,7 @@ Dan Armbrust
Daniel Ribagnac
Daniel Spilker
Danno Ferrin
+Dante Briones
Davanum Srinivas
Dave Brondsema
Dave Brosius
diff --git a/WHATSNEW b/WHATSNEW
index e36978588..38177f62e 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -44,6 +44,11 @@ Changes that could break older environments:
simultaniously (while within
The onerror attribute specifies how to proceed when an error occurs during the execution of one of the statements. The possible values are: continue execution, only show the error; -stop execution and commit transaction; +stop execution, log the error but don't fail the task and abort execution and transaction and fail task.
diff --git a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java index 4a0ac32e0..708fbe34f 100644 --- a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java +++ b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java @@ -466,10 +466,14 @@ public class SQLExec extends JDBCTask { } } catch (IOException e) { closeQuietly(); - throw new BuildException(e, getLocation()); + if (onError.equals("abort")) { + throw new BuildException(e, getLocation()); + } } catch (SQLException e) { closeQuietly(); - throw new BuildException(e, getLocation()); + if (onError.equals("abort")) { + throw new BuildException(e, getLocation()); + } } finally { try { if (statement != null) { @@ -603,10 +607,12 @@ public class SQLExec extends JDBCTask { goodSql++; } catch (SQLException e) { log("Failed to execute: " + sql, Project.MSG_ERR); + if (!onError.equals("abort")) { + log(e.toString(), Project.MSG_ERR); + } if (!onError.equals("continue")) { throw e; } - log(e.toString(), Project.MSG_ERR); } finally { if (resultSet != null) { try {