Browse Source

Don't reposition the input stream when a \r is immediately followed by

the end of input.

Without that change, the unit test testMacLines would cause an endless
loop for JDK 1.1, at least with:

$ java -fullversion
java full version "Linux_JDK_1.1.8_v3_green_threads"


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270995 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 23 years ago
parent
commit
def57f9da8
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      src/main/org/apache/tools/ant/taskdefs/FixCRLF.java

+ 5
- 1
src/main/org/apache/tools/ant/taskdefs/FixCRLF.java View File

@@ -853,7 +853,7 @@ public class FixCRLF extends MatchingTask {
++eolcount; ++eolcount;
eolStr.append('\r'); eolStr.append('\r');
reader.mark(2); reader.mark(2);
switch ((char)(ch = reader.read())) {
switch ((ch = reader.read())) {
case '\r': case '\r':
if ((char)(ch = reader.read()) == '\n') { if ((char)(ch = reader.read()) == '\n') {
eolcount += 2; eolcount += 2;
@@ -864,6 +864,10 @@ public class FixCRLF extends MatchingTask {
++eolcount; ++eolcount;
eolStr.append('\n'); eolStr.append('\n');
break; break;
case -1:
// don't reposition when we've reached the end
// of the stream
break;
default: default:
reader.reset(); reader.reset();
break; break;


Loading…
Cancel
Save