PipedReader.java (ready): Throw IOException if pipe closed.

* java/io/PipedReader.java (ready): Throw IOException if pipe
	closed.
	* java/io/FilterReader.java (close): Don't clear `in'.
	* java/io/CharArrayReader.java (mark): Throw IOException if stream
	closed.
	(read, ready, reset, skip): Added exception message.
	* java/io/BufferedReader.java (mark, reset, ready, read, skip):
	Perform checkStatus check inside synchronized block.

From-SVN: r39641
This commit is contained in:
Tom Tromey 2001-02-13 18:55:13 +00:00 committed by Tom Tromey
parent 967eb03e12
commit f3b43865ac
5 changed files with 40 additions and 19 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.
@ -63,10 +63,12 @@ public class CharArrayReader extends Reader
}
}
public void mark(int readAheadLimit)
public void mark(int readAheadLimit) throws IOException
{
synchronized (lock)
{
if (buf == null)
throw new IOException("Stream closed");
// readAheadLimit is ignored per Java Class Lib. book, p. 318.
markedPos = pos;
}
@ -82,7 +84,7 @@ public class CharArrayReader extends Reader
synchronized (lock)
{
if (buf == null)
throw new IOException();
throw new IOException("Stream closed");
if (pos < 0)
throw new ArrayIndexOutOfBoundsException(pos);
@ -98,7 +100,7 @@ public class CharArrayReader extends Reader
synchronized (lock)
{
if (buf == null)
throw new IOException();
throw new IOException("Stream closed");
/* Don't need to check pos value, arraycopy will check it. */
if (off < 0 || len < 0 || off + len > b.length)
@ -117,7 +119,7 @@ public class CharArrayReader extends Reader
public boolean ready() throws IOException
{
if (buf == null)
throw new IOException();
throw new IOException("Stream closed");
return true;
}
@ -127,7 +129,7 @@ public class CharArrayReader extends Reader
synchronized (lock)
{
if (buf == null)
throw new IOException();
throw new IOException("Stream closed");
pos = markedPos;
}
@ -138,7 +140,7 @@ public class CharArrayReader extends Reader
synchronized (lock)
{
if (buf == null)
throw new IOException();
throw new IOException("Stream closed");
// Even though the var numChars is a long, in reality it can never
// be larger than an int since the result of subtracting 2 positive