diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 4b7406f615ebd458751c875a46d4378337d09d55..42ea2071ea01375e55cb5378c86b8d4763e2117e 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,18 @@
+2003-10-02  Michael Koch  <konqueror@gmx.de>
+
+	* java/net/InetAddress.java
+	(zeros): Removed.
+	(ANY_IF): Initalizie in static block.
+	(static): Load library with native methods here and initialize ANY_IF.
+	(isAnyLocalAddress): Check if equal to ANY_IF.
+	(equals): Use addr directly instead of addr1. Simplify for loop.
+	(toString): Rename "result" to "host" and add IP address allways.
+	(getLocalHost): Merged documentation from classpath.
+	* java/net/ServerSocket.java
+	(ServerSocket): New package-private constructor used by java.nio.
+	* java/net/URLConnection.java
+	(getRequestProperties): Check if already connected.
+
 2003-10-02  Michael Koch  <konqueror@gmx.de>
 
 	* java/nio/ByteBufferHelper.java:
diff --git a/libjava/java/net/InetAddress.java b/libjava/java/net/InetAddress.java
index bb82994768cf201d64dc7f7b350a38ef8060a87c..6d72d627c64353839efaf05f3690e0d260152858 100644
--- a/libjava/java/net/InetAddress.java
+++ b/libjava/java/net/InetAddress.java
@@ -38,6 +38,7 @@ exception statement from your version. */
 
 package java.net;
 
+import gnu.classpath.Configuration;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
@@ -63,17 +64,27 @@ public class InetAddress implements Serializable
 {
   private static final long serialVersionUID = 3286316764910316507L;
   
-  static final byte[] zeros = { 0, 0, 0, 0 };
-  
   /**
    * Dummy InetAddress, used to bind socket to any (all) network interfaces.
    */
-  static final InetAddress ANY_IF = new InetAddress (zeros, null);
+  static InetAddress ANY_IF;
     
   private static final byte[] localhostAddress = { 127, 0, 0, 1 };
 
   private static InetAddress localhost = null;
 
+  static
+  {
+    // load the shared library needed for name resolution
+    if (Configuration.INIT_LOAD_LIBRARY)
+      {
+        System.loadLibrary ("javanet");
+      }
+    
+    byte[] zeros = { 0, 0, 0, 0 };
+    ANY_IF = new InetAddress (zeros, null);
+  }
+
   /**
    * The Serialized Form specifies that an int 'address' is saved/restored.
    * This class uses a byte array internally so we'll just do the conversion
@@ -160,7 +171,7 @@ public class InetAddress implements Serializable
   {
     // This is the IPv4 implementation.
     // Any class derived from InetAddress should override this.
-    return addr == zeros;
+    return equals (ANY_IF);
   }
 
   /**
@@ -475,14 +486,13 @@ public class InetAddress implements Serializable
     // different host names."  This violates the description in the
     // JDK 1.2 API documentation.  A little experimentation
     // shows that the latter is correct.
-    byte[] addr1 = addr;
     byte[] addr2 = ((InetAddress) obj).addr;
     
-    if (addr1.length != addr2.length)
+    if (addr.length != addr2.length)
       return false;
     
-    for (int i = addr1.length;  --i >= 0;  )
-      if (addr1[i] != addr2[i])
+    for (int i = 0; i < addr.length; i++)
+      if (addr [i] != addr2 [i])
 	return false;
     
     return true;
@@ -497,15 +507,15 @@ public class InetAddress implements Serializable
    */
   public String toString()
   {
-    String result;
+    String host;
     String address = getHostAddress();
     
     if (hostName != null)
-      result = hostName + "/" + address;
+      host = hostName;
     else
-      result = address;
+      host = address;
     
-    return result;
+    return host + "/" + address;
   }
 
   /**
@@ -656,7 +666,10 @@ public class InetAddress implements Serializable
   private static native String getLocalHostname();
 
   /**
-   * Returns the local host address.
+   * Returns an InetAddress object representing the address of the current
+   * host.
+   *
+   * @return The local host's address
    *
    * @exception UnknownHostException If no IP address for the host could
    * be found
diff --git a/libjava/java/net/ServerSocket.java b/libjava/java/net/ServerSocket.java
index 44281783dc80e69e5d249dae1478ea658d24ceeb..6b5544b3a27dba18d8290b07b60bb27883f3eda2 100644
--- a/libjava/java/net/ServerSocket.java
+++ b/libjava/java/net/ServerSocket.java
@@ -74,6 +74,17 @@ public class ServerSocket
   private SocketImpl impl;
 
   private boolean closed = false;
+
+  /*
+   * This is only used by java.nio.
+   */
+  // FIXME: Workaround a bug in gcj.
+  //ServerSocket (PlainSocketImpl impl) throws IOException
+  ServerSocket (SocketImpl impl) throws IOException
+  {
+    this.impl = impl;
+    this.impl.create (true);
+  }
   
   /**
    * Constructor that simply sets the implementation.
@@ -318,8 +329,7 @@ public class ServerSocket
    */
   public void close () throws IOException
   {
-    if (impl != null)
-      impl.close ();
+    impl.close ();
 
     if (getChannel() != null)
       getChannel().close ();
diff --git a/libjava/java/net/URLConnection.java b/libjava/java/net/URLConnection.java
index 5c43a7cac24717d707d5b8968a2b07fc6a24d185..e39e5781639ed1d78651016b5a23274764ff67e1 100644
--- a/libjava/java/net/URLConnection.java
+++ b/libjava/java/net/URLConnection.java
@@ -1,5 +1,5 @@
 /* URLConnection.java -- Abstract superclass for reading from URL's
-   Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2002, 2003 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -45,9 +45,10 @@ import java.security.Permission;
 import java.security.AllPermission;
 import java.text.ParsePosition;
 import java.text.SimpleDateFormat;
+import java.util.Collections;
 import java.util.Date;
-import java.util.Locale;
 import java.util.Hashtable;
+import java.util.Locale;
 import java.util.Map;
 import java.util.StringTokenizer;
 import gnu.gcj.io.MimeTypes;
@@ -783,9 +784,12 @@ public abstract class URLConnection
    */
   public Map getRequestProperties()
   {
+    if (connected)
+      throw new IllegalStateException ("Already connected");
+
     // Overridden by subclasses that support reading header fields from the
     // request.
-    return null;
+    return Collections.EMPTY_MAP;
   }
 
   /**