Fix null pointer bug.
authorgreen <green@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 19 Sep 2001 18:28:59 +0000 (18:28 +0000)
committergreen <green@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 19 Sep 2001 18:28:59 +0000 (18:28 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45692 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/gnu/gcj/protocol/file/Handler.java

index d5add01..31745a9 100644 (file)
@@ -1,3 +1,8 @@
+2001-09-19  Anthony Green  <green@redhat.com>
+
+       * gnu/gcj/protocol/file/Handler.java: Avoid NullPointerException
+       when host is null.
+
 2001-09-17  Andreas Jaeger  <aj@suse.de>
 
        * jni.cc (array_from_valist): Use promoted types for va_arg.
index b12ebd4..b4d8fbf 100644 (file)
@@ -32,7 +32,8 @@ public class Handler extends URLStreamHandler
   {
     // 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