diff -ruN CVS/classpath/gnu/java/io/Base64InputStream.java updated/classpath/gnu/java/io/Base64InputStream.java
--- CVS/classpath/gnu/java/io/Base64InputStream.java	2006-12-21 16:02:50.000000000 +0300
+++ updated/classpath/gnu/java/io/Base64InputStream.java	2010-03-24 11:54:20.000000000 +0300
@@ -1,5 +1,5 @@
 /* Base64InputStream.java -- base-64 input stream.
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -105,10 +105,13 @@
    */
   public static byte[] decode(String base64) throws IOException
   {
+    byte bytes[] = new byte[base64.length()];
+    base64.getBytes(0, bytes.length, bytes, 0);
     Base64InputStream in =
-      new Base64InputStream(new ByteArrayInputStream(base64.getBytes()));
+      new Base64InputStream(new ByteArrayInputStream(bytes));
     ByteArrayOutputStream out =
-      new ByteArrayOutputStream((int) (base64.length() / 0.666));
+      new ByteArrayOutputStream((bytes.length >> 1) + bytes.length);
+
     byte[] buf = new byte[1024];
     int len;
     while ((len = in.read(buf)) != -1)
@@ -179,6 +182,7 @@
                     ;
                   if (i != BASE_64_PAD)
                     throw new IOException("malformed Base-64 input");
+                  // Fall through.
                 case 3:
                   while (Character.isWhitespace((char) (i = in.read())))
                     ;
diff -ruN CVS/classpath/gnu/java/net/loader/JarURLLoader.java updated/classpath/gnu/java/net/loader/JarURLLoader.java
--- CVS/classpath/gnu/java/net/loader/JarURLLoader.java	2006-12-19 00:37:40.000000000 +0300
+++ updated/classpath/gnu/java/net/loader/JarURLLoader.java	2010-03-24 11:54:20.000000000 +0300
@@ -1,3 +1,41 @@
+/* JarURLLoader.java -- Jar subclass of URLLoader
+   Copyright (C) 2006, 2010  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
 package gnu.java.net.loader;
 
 import gnu.java.net.IndexListParser;
@@ -26,17 +64,17 @@
 public final class JarURLLoader extends URLLoader
 {
   // True if we've initialized -- i.e., tried open the jar file.
-  boolean initialized;
+  private boolean initialized;
   // The jar file for this url.
   JarFile jarfile;
   // Base jar: url for all resources loaded from jar.
   final URL baseJarURL;
   // The "Class-Path" attribute of this Jar's manifest.
-  ArrayList<URLLoader> classPath;
+  private ArrayList<URLLoader> classPath;
   // If not null, a mapping from INDEX.LIST for this jar only.
   // This is a set of all prefixes and top-level files that
   // ought to be available in this jar.
-  Set indexSet;
+  private Set indexSet;
 
   // This constructor is used internally.  It purposely does not open
   // the jar file -- it defers this until later.  This allows us to
diff -ruN CVS/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java updated/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java
--- CVS/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java	2006-12-19 00:37:38.000000000 +0300
+++ updated/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java	2010-03-24 11:54:20.000000000 +0300
@@ -1,5 +1,5 @@
 /* HTTPURLConnection.java --
-   Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2006, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -80,7 +80,7 @@
   boolean keepAlive;
 
   private Request request;
-  private Headers requestHeaders;
+  private final Headers requestHeaders = new Headers();
   private ByteArrayOutputStream requestSink;
   private boolean requestMethodSetExplicitly;
 
@@ -98,7 +98,6 @@
     throws IOException
   {
     super(url);
-    requestHeaders = new Headers();
     String proxy = SystemProperties.getProperty("http.proxyHost");
     if (proxy != null && proxy.length() > 0)
       {
@@ -691,4 +690,3 @@
       }
   }
 }
-
diff -ruN CVS/classpath/gnu/java/net/protocol/file/Handler.java updated/classpath/gnu/java/net/protocol/file/Handler.java
--- CVS/classpath/gnu/java/net/protocol/file/Handler.java	2005-07-02 23:32:14.000000000 +0300
+++ updated/classpath/gnu/java/net/protocol/file/Handler.java	2010-03-24 12:02:46.000000000 +0300
@@ -1,5 +1,6 @@
 /* Handler.java -- "file" protocol handler for java.net
-   Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2010
+   Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -38,6 +39,7 @@
 package gnu.java.net.protocol.file;
 
 import java.io.IOException;
+import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLConnection;
 import java.net.URLStreamHandler;
@@ -74,15 +76,23 @@
     // If a hostname is set, then we need to switch protocols to ftp
     // in order to transfer this from the remote host.
     String host = url.getHost();
-    if ((host != null) && (! host.equals("")))
+    if ((host != null) && (! host.equals("")) &&
+        !host.equals("~") && !host.equals("localhost"))
       {
 	// Reset the protocol (and implicitly the handler) for this URL.
 	// Then have the URL attempt the connection again, as it will
 	// get the changed handler the next time around.
 	// If the ftp protocol handler is not installed, an 
-	// exception will be thrown from the new openConnection() call.
+        // exception will be thrown.
 	setURL (url, "ftp", url.getHost(), url.getPort(), url.getFile(),
 	        url.getRef());
+        if (!"ftp".equals(url.getProtocol()))
+          {
+            // This shouldn't really happen. (Just to prevent infinite
+            // recursion in case of missing ftp.Handler class.)
+            throw new MalformedURLException("Protocol handler not found: "
+                                            + "ftp");
+          }
 	return url.openConnection();
       }
 
diff -ruN CVS/classpath/gnu/java/nio/FileChannelImpl.java updated/classpath/gnu/java/nio/FileChannelImpl.java
--- CVS/classpath/gnu/java/nio/FileChannelImpl.java	2008-01-09 23:42:38.000000000 +0300
+++ updated/classpath/gnu/java/nio/FileChannelImpl.java	2010-03-24 11:54:20.000000000 +0300
@@ -1,5 +1,5 @@
 /* FileChannelImpl.java -- 
-   Copyright (C) 2002, 2004, 2005, 2006  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005, 2006, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -126,9 +126,9 @@
   /**
    * This is the actual native file descriptor value
    */
-  private VMChannel ch;
+  private final VMChannel ch;
 
-  private int mode;
+  private final int mode;
 
   final String description;
 
@@ -150,9 +150,10 @@
     this.ch = new VMChannel();
     ch.openFile(path, mode);
 
-    // First open the file and then check if it is a a directory
-    // to avoid race condition.
-    if (file.isDirectory())
+    // First open the file and then check if it is a directory
+    // to avoid race condition.  If the file is opened for writing
+    // successfully then it is already guaranteed to be not a directory.
+    if ((mode & WRITE) == 0 && file.isDirectory())
       {
 	try 
 	  {
@@ -163,7 +164,7 @@
 	    /* ignore it */
 	  }
 
-	throw new FileNotFoundException(description + " is a directory");
+        throw new FileNotFoundException(path + " is a directory");
       }
   }
 
@@ -237,6 +238,13 @@
   {
     if (position < 0)
       throw new IllegalArgumentException ("position: " + position);
+
+    if (!isOpen ())
+      throw new ClosedChannelException ();
+
+    if ((mode & READ) == 0)
+       throw new NonReadableChannelException ();
+
     long oldPosition = implPosition ();
     position (position);
     int result = read(dst);
@@ -317,7 +325,7 @@
     else
       throw new IllegalArgumentException ("mode: " + mode);
     
-    if (position < 0 || size < 0 || size > Integer.MAX_VALUE)
+    if (((position + size) | position | size) < 0 || size > Integer.MAX_VALUE)
       throw new IllegalArgumentException ("position: " + position
 					  + ", size: " + size);
     return ch.map(nmode, position, (int) size);
@@ -360,8 +368,7 @@
 			  WritableByteChannel target)
     throws IOException
   {
-    if (position < 0
-        || count < 0)
+    if (((position + count) | position | count) < 0)
       throw new IllegalArgumentException ("position: " + position
 					  + ", count: " + count);
 
@@ -424,8 +431,7 @@
 			    long count)
     throws IOException
   {
-    if (position < 0
-        || count < 0)
+    if (((position + count) | position | count) < 0)
       throw new IllegalArgumentException ("position: " + position
 					  + ", count: " + count);
 
@@ -456,8 +462,7 @@
   private void lockCheck(long position, long size, boolean shared)
     throws IOException
   {
-    if (position < 0
-        || size < 0)
+    if (((position + size) | position | size) < 0)
       throw new IllegalArgumentException ("position: " + position
 					  + ", size: " + size);
 
@@ -558,7 +563,7 @@
   {
     return (super.toString()
 	    + "[ fd: " + ch.getState()
-	    + "; mode: " + Integer.toOctalString(mode)
+            + "; mode: 0" + (mode != 0 ? Integer.toOctalString(mode) : "")
 	    + "; " + description + " ]");
   }
 
diff -ruN CVS/classpath/gnu/xml/dom/DomDocument.java updated/classpath/gnu/xml/dom/DomDocument.java
--- CVS/classpath/gnu/xml/dom/DomDocument.java	2008-06-26 00:06:20.000000000 +0300
+++ updated/classpath/gnu/xml/dom/DomDocument.java	2010-03-24 11:54:20.000000000 +0300
@@ -1,5 +1,5 @@
 /* DomDocument.java -- 
-   Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2004, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -436,8 +436,8 @@
             (c < 0x2c00 || c > 0x2fef) &&
             (c < 0x3001 || c > 0xd7ff) &&
             (c < 0xf900 || c > 0xfdcf) &&
-            (c < 0xfdf0 || c > 0xfffd) &&
-            (c < 0x10000 || c > 0xeffff))
+            (c < 0xfdf0 || c > 0xfffd)
+            /* && (c < 0x10000 || c > 0xeffff) */)
           {
             throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR,
                                       name, null, c);
@@ -494,7 +494,7 @@
                 (c < 0x3001 || c > 0xd7ff) &&
                 (c < 0xf900 || c > 0xfdcf) &&
                 (c < 0xfdf0 || c > 0xfffd) &&
-                (c < 0x10000 || c > 0xeffff) &&
+                /* (c < 0x10000 || c > 0xeffff) && */
                 c != 0x00b7 &&
                 (c < 0x0300 || c > 0x036f) &&
                 (c < 0x203f || c > 0x2040))
@@ -575,8 +575,8 @@
         // assume surrogate pairing checks out OK, for simplicity
         if ((c >= 0x0020 && c <= 0xd7ff) ||
             (c == 0x000a || c == 0x000d || c == 0x0009) ||
-            (c >= 0xe000 && c <= 0xfffd) ||
-            (c >= 0x10000 && c <= 0x10ffff))
+            (c >= 0xe000 && c <= 0xfffd)
+            /* || (c >= 0x10000 && c <= 0x10ffff) */)
           {
             continue;
           }
@@ -1553,4 +1553,3 @@
   }
 
 }
-
diff -ruN CVS/classpath/gnu/xml/dom/ImplementationSource.java updated/classpath/gnu/xml/dom/ImplementationSource.java
--- CVS/classpath/gnu/xml/dom/ImplementationSource.java	2005-07-02 23:32:16.000000000 +0300
+++ updated/classpath/gnu/xml/dom/ImplementationSource.java	2010-03-24 11:54:20.000000000 +0300
@@ -1,5 +1,5 @@
 /* ImplementationSource.java -- 
-   Copyright (C) 2004 Free Software Foundation, Inc..
+   Copyright (C) 2004, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -157,7 +157,7 @@
 
   final String getFeature(String features, int start, int end)
   {
-    if (features.length() > 0 && features.charAt(start) == '+')
+    if (features.length() > start && features.charAt(start) == '+')
       {
         return features.substring(start + 1, end);
       }
