Browse Source

Add a line ending at the end of the file used for unit test

Fix the code of Translate.java to preserve line endings


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274861 13f79535-47bb-0310-9956-ffa450edef68
master
Antoine Levy-Lambert 22 years ago
parent
commit
ff164b0006
2 changed files with 7 additions and 3 deletions
  1. +1
    -1
      src/etc/testcases/taskdefs/optional/i18n/translate/input/template.txt
  2. +6
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java

+ 1
- 1
src/etc/testcases/taskdefs/optional/i18n/translate/input/template.txt View File

@@ -1 +1 @@
@This@ @is@ @a@ @demo@ @file@ @for@ @the@ translate@_task@.
@This@ @is@ @a@ @demo@ @file@ @for@ @the@ translate@_task@.

+ 6
- 2
src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java View File

@@ -67,6 +67,7 @@ import java.util.Vector;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.filters.TokenFilter;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.util.FileUtils;
@@ -517,7 +518,10 @@ public class Translate extends MatchingTask {
BufferedReader in
= new BufferedReader(new InputStreamReader(fis, srcEncoding));
String line;
while ((line = in.readLine()) != null) {
TokenFilter.LineTokenizer lineTokenizer = new TokenFilter.LineTokenizer();
lineTokenizer.setIncludeDelims(true);
line = lineTokenizer.getToken(in);
while ((line) != null) {
// 2003-02-21 new replace algorithm by tbee (tbee@tbee.org)
// because it wasn't able to replace something like "@aaa;@bbb;"

@@ -579,7 +583,7 @@ public class Translate extends MatchingTask {


out.write(line);
out.newLine();
line = lineTokenizer.getToken(in);
}
if (in != null) {
in.close();


Loading…
Cancel
Save