bug in java.io.DataInputStream.readLine()

Mark Lentczner markl at glyphic.com
Thu Dec 10 17:29:52 PST 1998


Submitter-Id:	kaffe-user
Originator: 	Mark Lentczner
Organization:	Glyphic Technology
Confidential:	no
Synopsis:	java.io.DataInputStream.readLine() can't parse windows line
endings
Severity:	serious
Priority:	high
Category: 	kaffe
Class:		sw-bug
Release:	1.0.b3
Environment:
 	System: Linux shoobox 2.0.34 #2 Tue Sep 29 10:52:31 PDT 1998 i686
	Architecture: i686
Description:
	In the source file java/io/DataInputStream.java there is a bug on
	line 119, in the function readLine().  The test to see if the
	character is not a linefeed ('\n') should be on the variable data2,
	not data.  Thus the line should read:

		if (data2 != -1 && (char) (data2 & 0xff) != '\n') {

	The effect of this bug is that the if there is a CR-LF pair in the
	stream, it is read as two lines.

How-To-Repeat:
	Create a DataInputStream on a FileInputStream on a windows text
	file and you'll see that reading lines of text is incorrect.

	I found this as it cause the JVM Client98 Spec tests to fail.

Fix:
	Fix given above in the description.

	- Mark
-------------------
Mark Lentczner
President
Glyphic Technology
444 Castro Street, Suite 811
Mtn. View, CA 94041

markl at glyphic.com
http://www.glyphic.com/
650/964-5311 voice
650/967-4379 fax


More information about the kaffe mailing list