This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: Patch: File protocol handler fix
- To: green at cygnus dot com
- Subject: Re: Patch: File protocol handler fix
- From: Tom Tromey <tromey at redhat dot com>
- Date: 26 Sep 2001 08:21:27 -0600
- Cc: java-patches at gcc dot gnu dot org
- References: <200109191828.LAA32391@fencer.cygnus.com>
- Reply-To: tromey at redhat dot com
>>>>> "Anthony" == Anthony Green <green@redhat.com> writes:
Anthony> I'm checking in this obvious bug fix. URL.getHost() may
Anthony> return null, in which case this throws a
Anthony> NullPointerException.
Thanks.
Anthony> - if (! url.getHost().equals(""))
Anthony> + String host = url.getHost();
Anthony> + if ((host != null) && (! host.equals("")))
Sometimes I see this written as:
if (! "".equals (url.getHost ()))
This avoids the explicit check here. Dunno if it matters, but it is a
semi-idiom.
Tom