summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorStefan Bodewig <bodewig@apache.org>2017-04-11 16:32:00 +0200
committerStefan Bodewig <bodewig@apache.org>2017-04-11 16:32:00 +0200
commit00d140c1b2ac131485862741145ddfbd68024892 (patch)
tree72e02df64a1885aaf60d4d142e17990ed4e7208b /src/main
parentc11dcf20fa01d13c96a4017a734488ba763cc075 (diff)
parent53474759846a9ade58ddbd6f24b1649f16e3233f (diff)
downloadant-00d140c1b2ac131485862741145ddfbd68024892.tar.gz
Merge branch '1.9.x'
Diffstat (limited to 'src/main')
-rw-r--r--src/main/org/apache/tools/ant/filters/LineContainsRegExp.java15
1 files changed, 11 insertions, 4 deletions
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
@@ -220,6 +220,16 @@ public final class LineContainsRegExp
}
/**
+ * 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.
*/
private void initialize() {
@@ -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())) {