classpath-patches
[Top][All Lists]
Advanced

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

Re: [cp-patches] ensure LOCALHOST is used when localhost name is unsuabl


From: Raif S. Naffah
Subject: Re: [cp-patches] ensure LOCALHOST is used when localhost name is unsuable
Date: Mon, 2 Jan 2006 10:49:30 +1100
User-agent: KMail/1.9.1

hello Mark,

On Monday 02 January 2006 00:50, Mark Wielaard wrote:
> Hi Raif,
>
> On Tue, 2005-12-27 at 10:19 +1100, Raif S. Naffah wrote:
> > pls. find attached a patch to do the above.  sometimes, the
> > parameter localhost (to the InetAddress.getAllByName(String)
> > method) is an empty string which causes an UnknownHostException to
> > be thrown.  the patch ensures that if this is the case LOCALHOST is
> > used instead.
>
> This looks sane. I committed it as follows (removed the commented out
> code, moved the trim() up...

but now the test for null is done twice ;-)  if we're sticklers for 
performance, we probably should do:

if (xxx == null)
  doDefaultOrThrowException();
else
  {
    xxx = xxx.trim();
    if (xxx.length() == 0)
      doDefaultOrThrowException();
  }


> so we don't do it twice and added a comment 
> about trim in the ChangeLog entry).
>
> 2006-01-01  Raif S. Naffah  <address@hidden>
>
>        * java/net/InetAddress.java (getAllByName): use LOCALHOST if
>        localhost is null or is an empty string. Trim hostname before
>        lookup.

thanks.


> Could you add a Mauve test for this?

done.


cheers;
rsn

Attachment: pgpUs24sC_QHX.pgp
Description: PGP signature


reply via email to

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