FYI: Win32 InetAddress fix (really)
David Daney
ddaney@avtrex.com
Tue Oct 3 17:23:00 GMT 2006
Andrew Haley wrote:
> David Daney writes:
> > Gary Benson wrote:
> > > + // Some soon-to-be-removed native code synchronizes on this.
> > > + loopbackAddress = LOCALHOST;
> > > + }
> > > + catch (UnknownHostException e)
> > > + {
> > > + throw new RuntimeException("should never happen", e);
> > > + }
> > >
> > Would it be better to throw an InternalError here rather than
> > RuntimeException? If it truly should never happen then it would be an
> > InternalError if it did. If it can happen, then it should be of some
> > type the describes the problem.
>
> AFAICR this is the kind of thing that happens if the IP address of the
> loopback interface doesn't have a resolvable name,
>
I guess in this specific case it does not really matter as it is in a
static initializer and the result would be an ExceptionInInitiazerError
either way.
But in general I don't like the use RuntimeException. It makes me think
that we were too lazy to figure out what to do and took the easy (but
inelegant and probably incorrect) way out by circumventing java's
checked exception requirements.
David Daney
More information about the Java-patches
mailing list