[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: |
Mark Wielaard |
Subject: |
Re: [cp-patches] Patch: throw IOExceptions on closed PushbackInputStream operations |
Date: |
Thu, 15 Sep 2005 17:54:00 +0200 |
Hi Anthony,
On Thu, 2005-09-15 at 08:21 -0700, Anthony Green wrote:
> > 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.
Ah, right, sorry I missed that. In that case something like:
final byte[] buf = this.buf;
if (buf == null)
throw new IOException ("Stream closed");
<... use buf ...>
would be my preferred solution. But your try { } catch is equally valid.
Cheers,
Mark
signature.asc
Description: This is a digitally signed message part