Author: bodewig
Date: Mon Aug 24 14:12:59 2009
New Revision: 807230

URL: http://svn.apache.org/viewvc?rev=807230&view=rev
Log:
It may be better to set the property before an exception is thrown

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SQLExec.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SQLExec.java?rev=807230&r1=807229&r2=807230&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SQLExec.java 
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SQLExec.java Mon Aug 
24 14:12:59 2009
@@ -645,16 +645,16 @@
                 }
             } catch (IOException e) {
                 closeQuietly();
+                setErrorProperty();
                 if (onError.equals("abort")) {
                     throw new BuildException(e, getLocation());
                 }
-                setErrorProperty();
             } catch (SQLException e) {
                 closeQuietly();
+                setErrorProperty();
                 if (onError.equals("abort")) {
                     throw new BuildException(e, getLocation());
                 }
-                setErrorProperty();
             } finally {
                 try {
                     if (getStatement() != null) {
@@ -788,13 +788,13 @@
             goodSql++;
         } catch (SQLException e) {
             log("Failed to execute: " + sql, Project.MSG_ERR);
+            setErrorProperty();
             if (!onError.equals("abort")) {
                 log(e.toString(), Project.MSG_ERR);
             }
             if (!onError.equals("continue")) {
                 throw e;
             }
-            setErrorProperty();
         } finally {
             if (resultSet != null) {
                 try {
@@ -1093,12 +1093,12 @@
                 warning = warning.getNextWarning();
             }
         }
-        if (treatWarningsAsErrors && initialWarning != null) {
-            throw initialWarning;
-        }
         if (initialWarning != null) {
             setWarningProperty();
         }
+        if (treatWarningsAsErrors && initialWarning != null) {
+            throw initialWarning;
+        }
     }
 
     protected final void setErrorProperty() {


Reply via email to