diff --git a/WHATSNEW b/WHATSNEW index 3284d9854..5bc79b504 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -1,6 +1,13 @@ Changes from Ant 1.10.1 TO Ant 1.10.2 ===================================== +Fixed bugs: +----------- + + * 's child now skips s that lack a key or + value. + Bugzilla Report 60767 + Other changes: -------------- @@ -15,12 +22,8 @@ Other changes: * Added support for jarsigner's -tsadigestalg to . Bugzilla Report 60665 -Fixed bugs: ------------ - - * 's child now skips s that lack a key or - value. - Bugzilla Report 60767 + * added "regexp" attribute to + Bugzilla Report 60968 Changes from Ant 1.10.0 TO Ant 1.10.1 ===================================== diff --git a/manual/Types/filterchain.html b/manual/Types/filterchain.html index 4c5f94eda..8f4066f10 100644 --- a/manual/Types/filterchain.html +++ b/manual/Types/filterchain.html @@ -422,7 +422,12 @@ regular expression matching strings. regexp - Regular expression to be searched for. + Regular expression to be searched for.
+ Starting with 1.10.2 this also works as an attribute + on linecontainsregexp, in earlier versions of Ant + you must use a nested element when using the convenience + method. + Yes diff --git a/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java b/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java index 23a2005dd..4b7f53e36 100644 --- a/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java +++ b/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java @@ -219,6 +219,16 @@ public final class LineContainsRegExp return negate; } + /** + * Set the regular expression as an attribute. + * @since Ant 1.10.2 + */ + public void setRegexp(String pattern) { + RegularExpression regexp = new RegularExpression(); + regexp.setPattern(pattern); + regexps.addElement(regexp); + } + /** * Parses parameters to add user defined regular expressions. */ @@ -227,10 +237,7 @@ public final class LineContainsRegExp if (params != null) { for (int i = 0; i < params.length; i++) { if (REGEXP_KEY.equals(params[i].getType())) { - String pattern = params[i].getValue(); - RegularExpression regexp = new RegularExpression(); - regexp.setPattern(pattern); - regexps.addElement(regexp); + setRegexp(params[i].getValue()); } else if (NEGATE_KEY.equals(params[i].getType())) { setNegate(Project.toBoolean(params[i].getValue())); } else if (CS_KEY.equals(params[i].getType())) {