AntOnAIR: fixed issue in Replace task where if the token was replaced with a value that contained the token, the task could get stuck in an infinite loop
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/Replace.as b/ant_on_air/src/org/apache/flex/ant/tags/Replace.as
index 0b7ff69..2873ee1 100644
--- a/ant_on_air/src/org/apache/flex/ant/tags/Replace.as
+++ b/ant_on_air/src/org/apache/flex/ant/tags/Replace.as
@@ -129,7 +129,7 @@
var firstHalf:String = s.substr(0, c);
var secondHalf:String = s.substr(c);
s = firstHalf + secondHalf.replace(tokens[i], reps[i]);
- cur = c + 1;
+ cur = c + reps[i].length;
}
} while (c != -1)
}
diff --git a/ant_on_air/tests/test.xml b/ant_on_air/tests/test.xml
index 9b6cd8f..e218795 100644
--- a/ant_on_air/tests/test.xml
+++ b/ant_on_air/tests/test.xml
@@ -206,7 +206,7 @@
</replace>
<replace file="${basedir}/temp/custom.properties">
<replacetoken><![CDATA[<test/>]]></replacetoken>
- <replacevalue><![CDATA[<cdata/>]]></replacevalue>
+ <replacevalue><![CDATA[<replaced/><test/>]]></replacevalue>
</replace>
<loadproperties srcFile="${basedir}/temp/custom.properties" />
<fail message="replace did not work: found somekey">
@@ -240,10 +240,10 @@
</not>
</condition>
</fail>
- <fail message="replace did not work: did not find <cdata/>">
+ <fail message="replace did not work: did not find <replaced/><test/>">
<condition>
<not>
- <equals arg1="${xml}" arg2="<cdata/>" />
+ <equals arg1="${xml}" arg2="<replaced/><test/>" />
</not>
</condition>
</fail>