classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] Patch: Opening RandomAccessFiles requires excessive per


From: Christian Thalinger
Subject: Re: [cp-patches] Patch: Opening RandomAccessFiles requires excessive permission
Date: Tue, 06 Dec 2005 09:44:57 +0100

On Mon, 2005-12-05 at 14:42 +0000, Gary Benson wrote:
>    public void write (int oneByte) throws IOException
>    {
> +    if (out == null)
> +      throw new IOException("Bad file descriptor");
> +
>      out.write(oneByte);

I don't know if this is performance critical code or is used very often,
but this seems to be a special case and i'd suggest something like:

public void write (int oneByte) throws IOException
{
  try {
    out.write(oneByte);
    return;
  } catch (NullPointerException e) {
    throw new IOException("Bad file descriptor");
  }
}

I'll not win a beautiful-code prize, but will be compiled to the fastest
code.

TWISTI





reply via email to

[Prev in Thread] Current Thread [Next in Thread]