Browse Source

It may be better to set the property before an exception is thrown

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@807230 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 16 years ago
parent
commit
8d275b78c2
1 changed files with 6 additions and 6 deletions
  1. +6
    -6
      src/main/org/apache/tools/ant/taskdefs/SQLExec.java

+ 6
- 6
src/main/org/apache/tools/ant/taskdefs/SQLExec.java View File

@@ -645,16 +645,16 @@ public class SQLExec extends JDBCTask {
} }
} catch (IOException e) { } catch (IOException e) {
closeQuietly(); closeQuietly();
setErrorProperty();
if (onError.equals("abort")) { if (onError.equals("abort")) {
throw new BuildException(e, getLocation()); throw new BuildException(e, getLocation());
} }
setErrorProperty();
} catch (SQLException e) { } catch (SQLException e) {
closeQuietly(); closeQuietly();
setErrorProperty();
if (onError.equals("abort")) { if (onError.equals("abort")) {
throw new BuildException(e, getLocation()); throw new BuildException(e, getLocation());
} }
setErrorProperty();
} finally { } finally {
try { try {
if (getStatement() != null) { if (getStatement() != null) {
@@ -788,13 +788,13 @@ public class SQLExec extends JDBCTask {
goodSql++; goodSql++;
} catch (SQLException e) { } catch (SQLException e) {
log("Failed to execute: " + sql, Project.MSG_ERR); log("Failed to execute: " + sql, Project.MSG_ERR);
setErrorProperty();
if (!onError.equals("abort")) { if (!onError.equals("abort")) {
log(e.toString(), Project.MSG_ERR); log(e.toString(), Project.MSG_ERR);
} }
if (!onError.equals("continue")) { if (!onError.equals("continue")) {
throw e; throw e;
} }
setErrorProperty();
} finally { } finally {
if (resultSet != null) { if (resultSet != null) {
try { try {
@@ -1093,12 +1093,12 @@ public class SQLExec extends JDBCTask {
warning = warning.getNextWarning(); warning = warning.getNextWarning();
} }
} }
if (treatWarningsAsErrors && initialWarning != null) {
throw initialWarning;
}
if (initialWarning != null) { if (initialWarning != null) {
setWarningProperty(); setWarningProperty();
} }
if (treatWarningsAsErrors && initialWarning != null) {
throw initialWarning;
}
} }


protected final void setErrorProperty() { protected final void setErrorProperty() {


Loading…
Cancel
Save