This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch: fixlet for InputStreamReader


I'm checking this in on the trunk.  This fixes a bug I found in
InputStreamReader.  In some situations it would erroneously decide it
hit EOF.  This happened because it was calling `in.refill ()' in the
wrong situation.  I'm still not very confident of this code.  It might
be possible for it to not make progress in some situations.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* java/io/InputStreamReader.java (refill): Only call refill on
	BufferedInputStream when appropriate constraints are met.

Index: java/io/InputStreamReader.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/InputStreamReader.java,v
retrieving revision 1.9
diff -u -r1.9 InputStreamReader.java
--- java/io/InputStreamReader.java 2001/07/13 05:41:28 1.9
+++ java/io/InputStreamReader.java 2001/08/06 21:56:46
@@ -149,7 +149,9 @@
 	// We have knowledge of the internals of BufferedInputStream
 	// here.  Eww.
 	in.mark (0);
-	boolean r = in.refill ();
+	// BufferedInputStream.refill() can only be called when
+	// `pos>=count'.
+	boolean r = in.pos < in.count || in.refill ();
 	in.reset ();
 	if (! r)
 	  return false;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]