diff --git a/WHATSNEW b/WHATSNEW index 4555b1dd3..67bf04a45 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -20,6 +20,9 @@ Fixed bugs: * Target from imported file listed twice in projecthelp. Bugzilla report 41226. +* task double-expands properties if expandproperties is true, + and expands properties if expandproperties is false. + Bugzilla report 41204. Other changes: -------------- diff --git a/docs/manual/CoreTasks/sql.html b/docs/manual/CoreTasks/sql.html index b550b750b..81c0e8ec1 100644 --- a/docs/manual/CoreTasks/sql.html +++ b/docs/manual/CoreTasks/sql.html @@ -185,7 +185,7 @@ and abort execution and transaction and fail task.

expandproperties Set to true to turn on property expansion in nested SQL, inline in the task or nested transactions. Since Ant 1.7. - No (default=false) + No (default=true) diff --git a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java index 9fbd0b1b7..aadcf84bb 100644 --- a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java +++ b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java @@ -190,7 +190,7 @@ public class SQLExec extends JDBCTask { * * @since Ant 1.7 */ - private boolean expandProperties = false; + private boolean expandProperties = true; /** * Set the name of the SQL file to be run. @@ -491,7 +491,9 @@ public class SQLExec extends JDBCTask { if (!keepformat) { line = line.trim(); } - line = getProject().replaceProperties(line); + if (expandProperties) { + line = getProject().replaceProperties(line); + } if (!keepformat) { if (line.startsWith("//")) { continue; @@ -738,9 +740,6 @@ public class SQLExec extends JDBCTask { */ public void addText(String sql) { if (sql != null) { - if (getExpandProperties()) { - sql = getProject().replaceProperties(sql); - } this.tSqlCommand += sql; } }