ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From denisbou...@free.fr
Subject Ant replaceregexp match="$" replace="\n\$" erroneous behaviour ?
Date Wed, 24 Mar 2004 17:45:18 GMT
Hi,

I've got a file in which I'd like to replace all the character $ by cariage
return and $. 
So the following :
----
$AdminControl tagada $AdminApp togodo
----

Will be replaced by :
---

$AdminControl tagada
$AdminApp togodo
---

I've decided to use ORO 2.0.8 with ant 1.5 with this line :
 <replaceregexp file="installTurlututuEarWASReadable.jacl" match="\$"
replace="\n\$" flags="g"/>

However, I've got the following exception :
BUILD FAILED
java.lang.StringIndexOutOfBoundsException: String index out of range: 2
        at java.lang.String.charAt(String.java(Compiled Code))
        at java.util.regex.Matcher.appendReplacement(Matcher.java:566)
        at java.util.regex.Matcher.replaceAll(Matcher.java:660)
        at
org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp.substitute(Jdk14RegexpRegexp.java:112)
        at
org.apache.tools.ant.taskdefs.optional.ReplaceRegExp.doReplace(ReplaceRegExp.java:289)
        at
org.apache.tools.ant.taskdefs.optional.ReplaceRegExp.doReplace(ReplaceRegExp.java:410)
        at
org.apache.tools.ant.taskdefs.optional.ReplaceRegExp.execute(ReplaceRegExp.java:491)
        at org.apache.tools.ant.Task.perform(Task.java:341)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
        at org.apache.tools.ant.Main.runBuild(Main.java:609)
        at org.apache.tools.ant.Main.start(Main.java:196)
        at org.apache.tools.ant.Main.main(Main.java:235)
 
Total time: 1 second
java.lang.StringIndexOutOfBoundsException: String index out of range: 2
        at java.lang.String.charAt(String.java(Compiled Code))
        at java.util.regex.Matcher.appendReplacement(Matcher.java:566)
        at java.util.regex.Matcher.replaceAll(Matcher.java:660)
        at
org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp.substitute(Jdk14RegexpRegexp.java:112)
        at
org.apache.tools.ant.taskdefs.optional.ReplaceRegExp.doReplace(ReplaceRegExp.java:289)
        at
org.apache.tools.ant.taskdefs.optional.ReplaceRegExp.doReplace(ReplaceRegExp.java:410)
        at
org.apache.tools.ant.taskdefs.optional.ReplaceRegExp.execute(ReplaceRegExp.java:491)
        at org.apache.tools.ant.Task.perform(Task.java:341)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
        at org.apache.tools.ant.Main.runBuild(Main.java:609)
        at org.apache.tools.ant.Main.start(Main.java:196)
        at org.apache.tools.ant.Main.main(Main.java:235)

Have you got an idea on how to resolve that ?

Regards,
Denis Boutin.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message