From 8d275b78c2240031dca97d3eba6ba0f592987d62 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Mon, 24 Aug 2009 14:12:59 +0000 Subject: [PATCH] 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 --- src/main/org/apache/tools/ant/taskdefs/SQLExec.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java index 9166e355f..707830a29 100644 --- a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java +++ b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java @@ -645,16 +645,16 @@ public class SQLExec extends JDBCTask { } } 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 @@ public class SQLExec extends JDBCTask { 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 @@ public class SQLExec extends JDBCTask { warning = warning.getNextWarning(); } } - if (treatWarningsAsErrors && initialWarning != null) { - throw initialWarning; - } if (initialWarning != null) { setWarningProperty(); } + if (treatWarningsAsErrors && initialWarning != null) { + throw initialWarning; + } } protected final void setErrorProperty() {