This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: fix for PR 1913
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Subject: Patch: fix for PR 1913
- From: Tom Tromey <tromey at redhat dot com>
- Date: 08 Feb 2001 18:52:17 -0700
- Reply-To: tromey at redhat dot com
I'm checking this in. It is a contribution from the submitter of PR
libgcj/1913. It seems correct and low-risk to me. See the PR for
details of the problem it fixes.
This same bug probably affects other subclasses of Reader. I haven't
looked, but I made a note and I'll try to look soon.
I don't recall this behavior being specified before, but the online
1.2 docs require it in the description of Reader.close().
2001-02-08 Tom Tromey <tromey@redhat.com>
From paul@dawa.demon.co.uk. Fix for PR libgcj/1913:
* java/io/InputStreamReader.java (ready, read): Throw IOException
if stream has been closed.
Tom
Index: java/io/InputStreamReader.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/InputStreamReader.java,v
retrieving revision 1.7
diff -u -r1.7 InputStreamReader.java
--- InputStreamReader.java 2000/11/29 10:06:03 1.7
+++ InputStreamReader.java 2001/02/09 01:49:39
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2001 Free Software Foundation
This file is part of libgcj.
@@ -71,6 +71,9 @@
{
synchronized (lock)
{
+ if (in == null)
+ throw new IOException("Stream closed");
+
if (wpos < wcount)
return true;
if (work == null)
@@ -102,6 +105,9 @@
{
synchronized (lock)
{
+ if (in == null)
+ throw new IOException("Stream closed");
+
int wavail = wcount - wpos;
if (wavail > 0)
{
@@ -136,6 +142,9 @@
{
synchronized (lock)
{
+ if (in == null)
+ throw new IOException("Stream closed");
+
int wavail = wcount - wpos;
if (wavail > 0)
return work[wpos++];