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
This commit is contained in:
Tom Tromey 2001-02-09 01:54:38 +00:00 committed by Tom Tromey
parent 1b43b6be4a
commit 8a5f950e04
2 changed files with 16 additions and 1 deletions

View file

@ -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 @@ public class InputStreamReader extends Reader
{
synchronized (lock)
{
if (in == null)
throw new IOException("Stream closed");
if (wpos < wcount)
return true;
if (work == null)
@ -102,6 +105,9 @@ public class InputStreamReader extends Reader
{
synchronized (lock)
{
if (in == null)
throw new IOException("Stream closed");
int wavail = wcount - wpos;
if (wavail > 0)
{
@ -136,6 +142,9 @@ public class InputStreamReader extends Reader
{
synchronized (lock)
{
if (in == null)
throw new IOException("Stream closed");
int wavail = wcount - wpos;
if (wavail > 0)
return work[wpos++];