diff --git a/WHATSNEW b/WHATSNEW index d3fbee467..767edf50a 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -4,6 +4,8 @@ Changes from Ant 1.8.0RC1 TO current SVN version Changes that could break older environments: ------------------------------------------- + * the appendtolines filter has been renamed to suffixlines. + Fixed bugs: ----------- diff --git a/docs/manual/CoreTypes/filterchain.html b/docs/manual/CoreTypes/filterchain.html index f4ceff993..937536d88 100644 --- a/docs/manual/CoreTypes/filterchain.html +++ b/docs/manual/CoreTypes/filterchain.html @@ -107,7 +107,6 @@ The following built-in tasks support nested <filterchain> ele A FilterChain is formed by defining zero or more of the following nested elements.
FilterReader
-AppendToLines
ClassConstants
EscapeUnicode
ExpandProperties
@@ -119,6 +118,7 @@ nested elements.
StripJavaComments
StripLineBreaks
StripLineComments
+SuffixLines
TabsToSpaces
TailFilter
DeleteCharacters
@@ -479,9 +479,9 @@ Convenience method: <prefixlines prefix="Foo"/> -

AppendToLines

+

SuffixLines

-Attaches an appendix to every line. +Attaches a suffix to every line.

since Ant 1.8.0

@@ -492,24 +492,24 @@ Attaches an appendix to every line. Required - append - Appendix to be attached to lines. + suffix + Suffix to be attached to lines. Yes

Example:

-This will attach the appendix Foo to all lines. +This will attach the suffix Foo to all lines.
-<filterreader classname="org.apache.tools.ant.filters.AppendToLines">
-  <param name="append" value="Foo"/>
+<filterreader classname="org.apache.tools.ant.filters.SuffixLines">
+  <param name="suffix" value="Foo"/>
 </filterreader>
 
Convenience method:
-<appendtolines append="Foo"/>
+<suffixlines suffix="Foo"/>
 

ReplaceTokens

diff --git a/src/main/org/apache/tools/ant/filters/AppendToLines.java b/src/main/org/apache/tools/ant/filters/SuffixLines.java similarity index 75% rename from src/main/org/apache/tools/ant/filters/AppendToLines.java rename to src/main/org/apache/tools/ant/filters/SuffixLines.java index b065bf2dd..a4bdceea9 100644 --- a/src/main/org/apache/tools/ant/filters/AppendToLines.java +++ b/src/main/org/apache/tools/ant/filters/SuffixLines.java @@ -25,24 +25,24 @@ import org.apache.tools.ant.types.Parameter; * Attaches a suffix to every line. * * Example: - *
<appendtolines append="Foo"/>
+ *
<suffixlines suffix="Foo"/>
* * Or: * - *
<filterreader classname="org.apache.tools.ant.filters.AppendToLines">
- *  <param name="append" value="Foo"/>
+ * 
<filterreader classname="org.apache.tools.ant.filters.SuffixLines">
+ *  <param name="suffix" value="Foo"/>
  * </filterreader>
* * @since Ant 1.8.0 */ -public final class AppendToLines +public final class SuffixLines extends BaseParamFilterReader implements ChainableReader { /** Parameter name for the prefix. */ - private static final String APPEND_KEY = "append"; + private static final String SUFFIX_KEY = "suffix"; - /** The appendix to be used. */ - private String append = null; + /** The suffix to be used. */ + private String suffix = null; /** Data that must be read from, if not null. */ private String queuedData = null; @@ -52,7 +52,7 @@ public final class AppendToLines * * @see BaseFilterReader#BaseFilterReader() */ - public AppendToLines() { + public SuffixLines() { super(); } @@ -62,13 +62,13 @@ public final class AppendToLines * @param in A Reader object providing the underlying stream. * Must not be null. */ - public AppendToLines(final Reader in) { + public SuffixLines(final Reader in) { super(in); } /** * Returns the next character in the filtered stream. One line is read - * from the original input, and the appendix added. The resulting + * from the original input, and the suffix added. The resulting * line is then used until it ends, at which point the next original line * is read, etc. * @@ -101,7 +101,7 @@ public final class AppendToLines if (queuedData == null) { ch = -1; } else { - if (append != null) { + if (suffix != null) { String lf = ""; if (queuedData.endsWith("\r\n")) { lf = "\r\n"; @@ -111,7 +111,7 @@ public final class AppendToLines queuedData = queuedData.substring(0, queuedData.length() - lf.length()) - + append + lf; + + suffix + lf; } return read(); } @@ -120,27 +120,27 @@ public final class AppendToLines } /** - * Sets the appendix to add at the end of each input line. + * Sets the suffix to add at the end of each input line. * - * @param append The appendix to add at the end of each input line. - * May be null, in which case no appendix + * @param suffix The suffix to add at the end of each input line. + * May be null, in which case no suffix * is added. */ - public void setAppend(final String append) { - this.append = append; + public void setSuffix(final String append) { + this.suffix = append; } /** - * Returns the appendix which will be added at the end of each input line. + * Returns the suffix which will be added at the end of each input line. * - * @return the appendix which will be added at the end of each input line + * @return the suffix which will be added at the end of each input line */ - private String getAppend() { - return append; + private String getSuffix() { + return suffix; } /** - * Creates a new AppendToLines filter using the passed in + * Creates a new SuffixLines filter using the passed in * Reader for instantiation. * * @param rdr A Reader object providing the underlying stream. @@ -150,21 +150,21 @@ public final class AppendToLines * the specified reader */ public Reader chain(final Reader rdr) { - AppendToLines newFilter = new AppendToLines(rdr); - newFilter.setAppend(getAppend()); + SuffixLines newFilter = new SuffixLines(rdr); + newFilter.setSuffix(getSuffix()); newFilter.setInitialized(true); return newFilter; } /** - * Initializes the appendix if it is available from the parameters. + * Initializes the suffix if it is available from the parameters. */ private void initialize() { Parameter[] params = getParameters(); if (params != null) { for (int i = 0; i < params.length; i++) { - if (APPEND_KEY.equals(params[i].getName())) { - append = params[i].getValue(); + if (SUFFIX_KEY.equals(params[i].getName())) { + suffix = params[i].getValue(); break; } } diff --git a/src/main/org/apache/tools/ant/types/FilterChain.java b/src/main/org/apache/tools/ant/types/FilterChain.java index c5492564c..0a5d6b7f2 100644 --- a/src/main/org/apache/tools/ant/types/FilterChain.java +++ b/src/main/org/apache/tools/ant/types/FilterChain.java @@ -23,7 +23,6 @@ import java.util.Vector; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; -import org.apache.tools.ant.filters.AppendToLines; import org.apache.tools.ant.filters.ChainableReader; import org.apache.tools.ant.filters.ClassConstants; import org.apache.tools.ant.filters.EscapeUnicode; @@ -36,6 +35,7 @@ import org.apache.tools.ant.filters.ReplaceTokens; import org.apache.tools.ant.filters.StripJavaComments; import org.apache.tools.ant.filters.StripLineBreaks; import org.apache.tools.ant.filters.StripLineComments; +import org.apache.tools.ant.filters.SuffixLines; import org.apache.tools.ant.filters.TabsToSpaces; import org.apache.tools.ant.filters.TailFilter; import org.apache.tools.ant.filters.TokenFilter; @@ -156,17 +156,17 @@ public class FilterChain extends DataType } /** - * Add a AppendToLines filter. + * Add a SuffixLines filter. * - * @param prefixLines a AppendToLines value + * @param suffixLines a SuffixLines value * @since Ant 1.8.0 */ - public void addAppendToLines(final AppendToLines appendToLines) { + public void addSuffixLines(final SuffixLines suffixLines) { if (isReference()) { throw noChildrenAllowed(); } setChecked(false); - filterReaders.addElement(appendToLines); + filterReaders.addElement(suffixLines); } /** diff --git a/src/tests/antunit/filters/append-test.xml b/src/tests/antunit/filters/suffix-test.xml similarity index 97% rename from src/tests/antunit/filters/append-test.xml rename to src/tests/antunit/filters/suffix-test.xml index f953de2b3..a0a9403cd 100644 --- a/src/tests/antunit/filters/append-test.xml +++ b/src/tests/antunit/filters/suffix-test.xml @@ -33,7 +33,7 @@ cFoo - +