Bug 37405

Summary: optional delimiter attribute to the Replace task
Product: Ant Reporter: Steve Hespelt <shespelt>
Component: Core tasksAssignee: Ant Notifications List <notifications>
Status: NEW ---    
Severity: enhancement    
Priority: P2    
Version: 1.6.2   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Steve Hespelt 2005-11-08 17:29:29 UTC
When using the replacefilterfile attribute, it would be handy to be able to
specify what delimiter should be used. Unfortunately, someone here has already
created a good number of config files using the pattern  #property.name# so one
would have to first create the temporary property file argument to
replacefilterfile with the delimeters appended/prepended. I've made a simple
change that allows for an optional attribute (default value "@@") to do this
prepending/appending when retrieving the token from the set of properties loaded
from the replacefilterfile file.
This way, a property file could be used as is and allow the Replace task to
create the 'correct' pattern.
Here is the diff:
[shespelt_cr16875] racssv05:62> diff Replace.java.orig Replace.java
60a61
>     private String delimiter="@@";
238c239,245
<                     replaceFilter.setToken(token);
---
>                     if ( token.startsWith( this.delimiter ) ) {
>                         replaceFilter.setToken(token);
>                     } else {
>                         // this allows for our replacefilterfile to be a
simple property file
>                         replaceFilter.setToken( this.delimiter + token +
this.delimiter );
>                     }
>
503a511,514
>     }
>
>     public void setDelimiter( String delim ) {
>         delimiter = delim;