This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: File protocol handler fix
- To: java-patches at gcc dot gnu dot org
- Subject: Patch: File protocol handler fix
- From: Anthony Green <green at redhat dot com>
- Date: Wed, 19 Sep 2001 11:28:07 -0700
- Reply-to: green at cygnus dot com
I'm checking in this obvious bug fix. URL.getHost() may return null,
in which case this throws a NullPointerException.
2001-09-19 Anthony Green <green@redhat.com>
* gnu/gcj/protocol/file/Handler.java: Avoid NullPointerException
when host is null.
Index: gnu/gcj/protocol/file/Handler.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/gcj/protocol/file/Handler.java,v
retrieving revision 1.4
diff -u -p -r1.4 Handler.java
--- Handler.java 2000/04/21 14:18:49 1.4
+++ Handler.java 2001/09/19 18:23:24
@@ -32,7 +32,8 @@ public class Handler extends URLStreamHa
{
// If a hostname is set, then we need to switch protocols to ftp
// in order to transfer this from the remote host.
- if (! url.getHost().equals(""))
+ String host = url.getHost();
+ if ((host != null) && (! host.equals("")))
{
// Reset the protocol (and implicitly the handler) for this URL.
// Then have the URL attempt the connection again, as it will