Patch: File protocol handler fix
Anthony Green
green@redhat.com
Wed Sep 19 11:28:00 GMT 2001
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
More information about the Java-patches
mailing list