diff -ruN CVS/classpath/gnu/java/net/PlainSocketImpl.java updated/classpath/gnu/java/net/PlainSocketImpl.java
--- CVS/classpath/gnu/java/net/PlainSocketImpl.java	2006-11-27 00:32:30.000000000 +0300
+++ updated/classpath/gnu/java/net/PlainSocketImpl.java	2010-03-24 11:54:20.000000000 +0300
@@ -1,5 +1,5 @@
 /* PlainSocketImpl.java -- Default socket implementation
-   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2010
    Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -52,7 +52,9 @@
 import java.net.SocketException;
 import java.net.SocketImpl;
 import java.net.SocketTimeoutException;
+import java.net.UnknownHostException;
 import java.nio.ByteBuffer;
+import java.nio.channels.UnresolvedAddressException;
 
 /**
  * Written using on-line Java Platform 1.2 API Specification, as well
@@ -278,7 +280,16 @@
   {
     if (channel == null)
       create(true);
-    boolean connected = channel.connect(address, timeout);
+    boolean connected;
+    try
+      {
+        connected = channel.connect(address, timeout);
+      }
+    catch (UnresolvedAddressException e)
+      {
+        throw new UnknownHostException(
+                    ((InetSocketAddress) address).getHostName());
+      }
     if (!connected)
       throw new SocketTimeoutException("connect timed out");
     
diff -ruN CVS/classpath/gnu/java/net/loader/FileURLLoader.java updated/classpath/gnu/java/net/loader/FileURLLoader.java
--- CVS/classpath/gnu/java/net/loader/FileURLLoader.java	2006-05-16 02:29:36.000000000 +0300
+++ updated/classpath/gnu/java/net/loader/FileURLLoader.java	2010-03-24 11:54:20.000000000 +0300
@@ -1,5 +1,5 @@
 /* FileURLLoader.java -- a URLLoader for file URLs
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -41,6 +41,7 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.net.URLStreamHandlerFactory;
@@ -52,7 +53,7 @@
  */
 public final class FileURLLoader extends URLLoader
 {
-  File dir; //the file for this file url
+  private final File dir; //the file for this file url
 
   public FileURLLoader(URLClassLoader classloader,
                        URLStreamHandlerCache cache,
@@ -60,7 +61,16 @@
                        URL url, URL absoluteUrl)
   {
     super(classloader, cache, factory, url, absoluteUrl);
-    dir = new File(absoluteUrl.getFile());
+    String path = absoluteUrl.getFile();
+    try
+      {
+        path = gnu.java.net.protocol.file.Connection.unquote(path);
+      }
+    catch (MalformedURLException e)
+      {
+        // ignore
+      }
+    dir = new File(path);
   }
 
   /** get resource with the name "name" in the file url */
diff -ruN CVS/classpath/gnu/java/net/protocol/file/Connection.java updated/classpath/gnu/java/net/protocol/file/Connection.java
--- CVS/classpath/gnu/java/net/protocol/file/Connection.java	2006-03-06 05:42:20.000000000 +0300
+++ updated/classpath/gnu/java/net/protocol/file/Connection.java	2010-03-24 11:54:20.000000000 +0300
@@ -1,5 +1,5 @@
-/* FileURLConnection.java -- URLConnection class for "file" protocol
-   Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc.
+/* Connection.java -- URLConnection class for "file" protocol
+   Copyright (C) 1998, 1999, 2003, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -51,6 +51,7 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
 import java.io.Writer;
 import java.net.ProtocolException;
 import java.net.URL;
@@ -76,7 +77,7 @@
    */
   private static final String DEFAULT_PERMISSION = "read";
 
-  private static class StaticData
+  private static final class StaticData
   {
     /**
      * HTTP-style DateFormat, used to format the last-modified header.
@@ -85,7 +86,7 @@
       = new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss 'GMT'",
                              new Locale ("En", "Us", "Unix"));
 
-    static String lineSeparator =
+    static final String lineSeparator =
       SystemProperties.getProperty("line.separator");
   }
 
@@ -113,7 +114,7 @@
   /**
    * FilePermission to read the file
    */
-  private FilePermission permission;
+  private final FilePermission permission;
 
   /**
    * Calls superclass constructor to initialize.
@@ -121,8 +122,17 @@
   public Connection(URL url)
   {
     super (url);
-
-    permission = new FilePermission(getURL().getFile(), DEFAULT_PERMISSION);
+    String path = getURL().getFile();
+    try
+      {
+        path = unquote(path);
+      }
+    catch (MalformedURLException e)
+      {
+        // ignore
+      }
+    permission = new FilePermission(path.replace('/', File.separatorChar),
+                   DEFAULT_PERMISSION);
   }
   
   /**
@@ -157,17 +167,22 @@
 	      throw new MalformedURLException(str + " : Invalid quoted character");
 	    buf[pos++] = (byte) (hi * 16 + lo);
 	  }
- 	else if (c > 127) {
-	    try {
-		byte [] c_as_bytes = Character.toString(c).getBytes("utf-8");
-		final int c_length = c_as_bytes.length;
-		System.arraycopy(c_as_bytes, 0, buf, pos, c_length);
-		pos += c_length;
-	    }
-	    catch (java.io.UnsupportedEncodingException x2) {
-		throw (Error) new InternalError().initCause(x2);
-	    }
-	}    
+         else if (c > 127)
+          {
+            if (c <= 0x7ff)
+              {
+                buf[pos] = (byte)((c >> 6) | 0xc0);
+                buf[pos + 1] = (byte)((c & 0x3f) | 0x80);
+                pos += 2;
+	      }
+            else
+              {
+                buf[pos] = (byte)((c >> 12) | 0xe0);
+                buf[pos + 1] = (byte)(((c >> 6) & 0x3f) | 0x80);
+                buf[pos + 2] = (byte)((c & 0x3f) | 0x80);
+                pos += 3;
+	      }
+          }
 	else
 	  buf[pos++] = (byte) c;
       }
@@ -175,7 +190,7 @@
       {
 	return new String(buf, 0, pos, "utf-8");
       }
-    catch (java.io.UnsupportedEncodingException x2)
+    catch (UnsupportedEncodingException x2)
       {
 	throw (Error) new InternalError().initCause(x2);
       }
@@ -231,6 +246,7 @@
     
         String[] files = file.list();
     
+        if (files != null)
         for (int i = 0; i < files.length; i++)
           {
             writer.write(files[i]);
@@ -315,7 +331,7 @@
           return guessContentTypeFromName(file.getName());
 	else if (field.equals("content-length"))
           {
-            if (file.isDirectory())
+            if (getDirectoryListing() != null)
               {
                 return Integer.toString(getContentLength());
               }
@@ -349,9 +365,9 @@
 	if (!connected)
 	  connect();
         
-        if (file.isDirectory())
+        if (getDirectoryListing() != null)
           {
-            return getDirectoryListing().length;
+            return directoryListing.length;
           }
 	return (int) file.length();
       }
