Commit 8a5f950e by Tom Tromey Committed by Tom Tromey

re PR libgcj/1913 (reading closed streams throws NullPointerException, not IOException)

	From paul@dawa.demon.co.uk.  Fix for PR libgcj/1913:
	* java/io/InputStreamReader.java (ready, read): Throw IOException
	if stream has been closed.

From-SVN: r39553
parent 1b43b6be
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.
2001-02-08 Joseph S. Myers <jsm28@cam.ac.uk> 2001-02-08 Joseph S. Myers <jsm28@cam.ac.uk>
* README, gij.cc, java/lang/natClass.cc, java/lang/natSystem.cc: * README, gij.cc, java/lang/natClass.cc, java/lang/natSystem.cc:
......
/* Copyright (C) 1998, 1999 Free Software Foundation /* Copyright (C) 1998, 1999, 2001 Free Software Foundation
This file is part of libgcj. This file is part of libgcj.
...@@ -71,6 +71,9 @@ public class InputStreamReader extends Reader ...@@ -71,6 +71,9 @@ public class InputStreamReader extends Reader
{ {
synchronized (lock) synchronized (lock)
{ {
if (in == null)
throw new IOException("Stream closed");
if (wpos < wcount) if (wpos < wcount)
return true; return true;
if (work == null) if (work == null)
...@@ -102,6 +105,9 @@ public class InputStreamReader extends Reader ...@@ -102,6 +105,9 @@ public class InputStreamReader extends Reader
{ {
synchronized (lock) synchronized (lock)
{ {
if (in == null)
throw new IOException("Stream closed");
int wavail = wcount - wpos; int wavail = wcount - wpos;
if (wavail > 0) if (wavail > 0)
{ {
...@@ -136,6 +142,9 @@ public class InputStreamReader extends Reader ...@@ -136,6 +142,9 @@ public class InputStreamReader extends Reader
{ {
synchronized (lock) synchronized (lock)
{ {
if (in == null)
throw new IOException("Stream closed");
int wavail = wcount - wpos; int wavail = wcount - wpos;
if (wavail > 0) if (wavail > 0)
return work[wpos++]; return work[wpos++];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment