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:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
* @author <a href="mailto:[EMAIL PROTECTED]">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:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>