Browse Source

Make filtersets preserve line endings

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274720 13f79535-47bb-0310-9956-ffa450edef68
master
Antoine Levy-Lambert 22 years ago
parent
commit
4ae9767592
2 changed files with 9 additions and 8 deletions
  1. +2
    -0
      WHATSNEW
  2. +7
    -8
      src/main/org/apache/tools/ant/util/FileUtils.java

+ 2
- 0
WHATSNEW View File

@@ -44,6 +44,8 @@ Fixed bugs:
* Filter readers were not handling line endings properly. Bugzilla
Report 18476.

* Filtersets were also not handling line endings properly.

* Expand tasks did not behave as expected with PatternSets.

* <property environment=... /> now works on OS/400.


+ 7
- 8
src/main/org/apache/tools/ant/util/FileUtils.java View File

@@ -80,6 +80,7 @@ import java.util.Vector;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.filters.util.ChainReaderHelper;
import org.apache.tools.ant.filters.TokenFilter;
import org.apache.tools.ant.taskdefs.condition.Os;
import org.apache.tools.ant.types.FilterSetCollection;

@@ -432,21 +433,19 @@ public class FileUtils {
in = new BufferedReader(rdr);
}

TokenFilter.LineTokenizer lineTokenizer = new TokenFilter.LineTokenizer();
lineTokenizer.setIncludeDelims(true);
String newline = null;
String line = in.readLine();
String line = lineTokenizer.getToken(in);
while (line != null) {
if (line.length() == 0) {
// this should not happen, because the lines are returned with the end of line delimiter
out.newLine();
} else {
if (filterSetsAvailable) {
newline = filters.replaceTokens(line);
} else {
newline = line;
}
newline = filters.replaceTokens(line);
out.write(newline);
out.newLine();
}
line = in.readLine();
line = lineTokenizer.getToken(in);
}
} finally {
if (out != null) {


Loading…
Cancel
Save