You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2014/06/02 19:11:25 UTC

[Bug 56584] New: Enhance org.apache.tools.antfilters.ReplaceTokens to support strings as begin and end token

https://issues.apache.org/bugzilla/show_bug.cgi?id=56584

            Bug ID: 56584
           Summary: Enhance org.apache.tools.antfilters.ReplaceTokens to
                    support strings as begin and end token
           Product: Ant
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Core
          Assignee: notifications@ant.apache.org
          Reporter: ralf.hergert.de@gmail.com

Ant's filter chains are a powerful concept, but so far non of the filters
manages to resolve a placeholder like "@@VERSION@@". While ReplaceTokens gets
close, it struggles on the repeating begin and end tokens.

If ReplaceTokens would support Strings instead of primitive chars, then
ReplaceTokens might be even capable replacing Velocity-style- (${...}) or
Mustache-style-placeholders ({{...}}).

I would love to eighter provide a patch for ReplaceTokens to deal with Strings
as limiters, or - if ReplaceTokens should not be touched - write another filter
class which can.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 56584] Enhance org.apache.tools.antfilters.ReplaceTokens to support strings as begin and end token

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56584

--- Comment #2 from Ralf Hergert <ra...@gmail.com> ---
Created attachment 31707
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31707&action=edit
patch which etends class ReplaceTokens to deal with Strings as begin- or
end-token

OK. I extended ReplaceTokens to deal with Strings as begin- and end-tokens.
Please find the patch as attachment. Origin git repository is:
https://git-wip-us.apache.org/repos/asf/ant.git

Besides changing char to String the extenal interface of this class has not
been changed and the existing tests for ReplaceTokens are still performed
successfully. I created two more tests two proof that also placeholders like
@@foo@@ can be replaced.

So far I did not update the documentation to the extended capabilities of
ReplaceTokens.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 56584] Enhance org.apache.tools.antfilters.ReplaceTokens to support strings as begin and end token

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56584

Ralf Hergert <ra...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #31707|0                           |1
        is obsolete|                            |

--- Comment #4 from Ralf Hergert <ra...@gmail.com> ---
Created attachment 31745
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31745&action=edit
fixed patch which extends class ReplaceTokens to deal with Strings as begin- or
end-token

Sure. The method TreeMap#ceilingKey is now replaced by TreeMap#tailMap, which
does essentially the same, but is supported in Java5. I recreated the patch,
instead of providing fixes for the previous patch file. I hope this is OK.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 56584] Enhance org.apache.tools.antfilters.ReplaceTokens to support strings as begin and end token

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56584

--- Comment #3 from Stefan Bodewig <bo...@apache.org> ---
going from chat to String in the setters is not exactly backwards compatible
but I'm willing to live with that.  It's pretty unlikely the class has been
used from Java code directly.

Unfortunately your patch relies on Java6 (TreeMap#ceilingKey) and currently Ant
targets Java5, do you think you could adapt it to the older API?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 56584] Enhance org.apache.tools.antfilters.ReplaceTokens to support strings as begin and end token

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56584

--- Comment #1 from Stefan Bodewig <bo...@apache.org> ---
extending ReplaceTokens sounds good to me

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 56584] Enhance org.apache.tools.antfilters.ReplaceTokens to support strings as begin and end token

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56584

Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |1.9.5

--- Comment #5 from Stefan Bodewig <bo...@apache.org> ---
Thank you, git commit 6e88f92

-- 
You are receiving this mail because:
You are the assignee for the bug.