ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs FixCRLF.java
Date Mon, 28 Jan 2002 16:42:07 GMT
bodewig     02/01/28 08:42:07

  Modified:    src/main/org/apache/tools/ant/taskdefs FixCRLF.java
  Log:
  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"
  
  Revision  Changes    Path
  1.30      +6 -2      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java
  
  Index: FixCRLF.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- FixCRLF.java	21 Jan 2002 15:33:43 -0000	1.29
  +++ FixCRLF.java	28 Jan 2002 16:42:07 -0000	1.30
  @@ -116,7 +116,7 @@
    *
    * @author Sam Ruby <a href="mailto:rubys@us.ibm.com">rubys@us.ibm.com</a>
    * @author <a href="mailto:pbwest@powerup.com.au">Peter B. West</a>
  - * @version $Revision: 1.29 $ $Name:  $
  + * @version $Revision: 1.30 $ $Name:  $
    */
   
   public class FixCRLF extends MatchingTask {
  @@ -853,7 +853,7 @@
                       ++eolcount;
                       eolStr.append('\r');
                       reader.mark(2);
  -                    switch ((char)(ch = reader.read())) {
  +                    switch ((ch = reader.read())) {
                       case '\r':
                           if ((char)(ch = reader.read()) == '\n') {
                               eolcount += 2;
  @@ -863,6 +863,10 @@
                       case '\n':
                           ++eolcount;
                           eolStr.append('\n');
  +                        break;
  +                    case -1:
  +                        // don't reposition when we've reached the end
  +                        // of the stream
                           break;
                       default:
                           reader.reset();
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message