[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cp-patches] Patch: throw IOExceptions on closed PushbackInputStream
From: |
Anthony Green |
Subject: |
Re: [cp-patches] Patch: throw IOExceptions on closed PushbackInputStream operations |
Date: |
Thu, 15 Sep 2005 08:21:24 -0700 |
On Thu, 2005-09-15 at 16:44 +0200, Mark Wielaard wrote:
> Hi,
>
> On Wed, 2005-09-14 at 18:00 -0700, Anthony Green wrote:
> > If you try an operation on a closed PushbackInputStream, you'll probably
> > get a NullPointerException. This patch turns them into IOExceptions
> > with an appropriate message. I think this is a better response based on
> > the spec (any error should throw an IOException).
> >
> > 2005-09-14 Anthony Green <address@hidden>
> >
> > * java/io/PushbackInputStream.java (available, read, skip): Handle
> > closed stream operations gracefully.
>
> Yes, but please write the following part like all others with an if
> statement at the start of the method:
But, unlike all the other methods, this method is unsynchronized.
Somebody could close the stream between the test and the use of buf. A
try/catch block seemed like the best solution.
I'll commit this after reformatting.
Thanks,
AG