This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the GCJ project. See the GCJ home page for more information.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Hello Warren
I have a small problem with the deprecated method DataInputStream.readLine
(and since your name was on the file ...)
The method believes every empty line is end of file, and returns null when
no characters where found, not when no characters where found before end
of file.
"Returns:
the next line of text from this input stream, or null if no bytes are
read before end-of-file is reached."
http://www.javasoft.com/products/jdk/1.1/docs/api/java.io.DataInputStream.html#readLine()
The behaviour has been compared with jdk1.1.7_v1a for Linux (and I _know_
this is how readLine should work).
ChangeLog:
1999-04-11 Urban Widmark <urban@svenskatest.se>
* java/io/DataInputStream.java (readLine): Corrected handling of
empty lines, from null to ""
I hope the diff and the ChangeLog entry are in the specified format.
Feel free to edit as necessary.
/Urban
---
Urban Widmark urban@svenskatest.se
Svenska Test AB +46 90 71 71 23
Index: libgcj/libjava/java/io/DataInputStream.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/io/DataInputStream.java,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 DataInputStream.java
*** DataInputStream.java 1999/04/07 14:52:35 1.1.1.1
--- DataInputStream.java 1999/04/11 15:03:16
*************** public class DataInputStream extends Fil
*** 105,111 ****
while (true)
{
! char ch = (char) read();
if (ch < 0 || (ch &= 0xFF) == '\n')
break;
if (ch == '\r')
--- 105,114 ----
while (true)
{
! int c = read();
! if(c == -1) // got an EOF
! return strb.length() > 0 ? strb.toString() : null;
! char ch = (char) c;
if (ch < 0 || (ch &= 0xFF) == '\n')
break;
if (ch == '\r')
*************** public class DataInputStream extends Fil
*** 148,154 ****
strb.append(ch);
}
! return strb.length() > 0 ? strb.toString() : null;
}
public final long readLong() throws IOException
--- 151,157 ----
strb.append(ch);
}
! return strb.length() > 0 ? strb.toString() : "";
}
public final long readLong() throws IOException