Browse Source

Prevent \r\n from being changed to \r\r\n under Windows

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274962 13f79535-47bb-0310-9956-ffa450edef68
master
Antoine Levy-Lambert 22 years ago
parent
commit
640b7f41f0
2 changed files with 8 additions and 2 deletions
  1. +2
    -0
      WHATSNEW
  2. +6
    -2
      src/main/org/apache/tools/ant/taskdefs/Replace.java

+ 2
- 0
WHATSNEW View File

@@ -216,6 +216,8 @@ Fixed bugs:
* ftp chmod failed when the remote system was UNIX and local system Windows * ftp chmod failed when the remote system was UNIX and local system Windows
Bugzilla Report 21865. Bugzilla Report 21865.


* replace would change \r\n into \r\r\n under Windows.

Other changes: Other changes:
-------------- --------------
* Six new Clearcase tasks added. * Six new Clearcase tasks added.


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

@@ -423,9 +423,13 @@ public class Replace extends MatchingTask {
// line separators in values and tokens are "\n" // line separators in values and tokens are "\n"
// in order to compare with the file contents, replace them // in order to compare with the file contents, replace them
// as needed // as needed
String val = stringReplace(value.getText(), "\n",
String val = stringReplace(value.getText(), "\r\n",
"\n", false);
val = stringReplace(val, "\n",
StringUtils.LINE_SEP, false); StringUtils.LINE_SEP, false);
String tok = stringReplace(token.getText(), "\n",
String tok = stringReplace(token.getText(), "\r\n",
"\n", false);
tok = stringReplace(tok, "\n",
StringUtils.LINE_SEP, false); StringUtils.LINE_SEP, false);


// for each found token, replace with value // for each found token, replace with value


Loading…
Cancel
Save