diff -ru CVS/classpath/gnu/java/io/PlatformHelper.java updated/classpath/gnu/java/io/PlatformHelper.java
--- CVS/classpath/gnu/java/io/PlatformHelper.java	2010-06-29 16:58:22.000000000 +0400
+++ updated/classpath/gnu/java/io/PlatformHelper.java	2010-06-30 12:13:18.000000000 +0400
@@ -1,5 +1,5 @@
 /* PlatformHelper.java -- Isolate OS-specific IO helper methods and variables
-   Copyright (C) 1998, 2002, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2002, 2006, 2010 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -37,19 +37,21 @@
 
 package gnu.java.io;
 
+import gnu.classpath.SystemProperties;
+
 /**
  * We had many changes in File.java, URLStreamHandler.java etc. to handle
  * path representations on different platforms (Windows/Unix-family).
  * Finally we'd like to collect all these ad hoc codes into this utility class.
  *       --Gansha
  */
-public class PlatformHelper
+public final class PlatformHelper
 {
-  public static final boolean isWindows = System.getProperty("os.name").indexOf("Windows") >= 0;
-  public static final String separator = System.getProperty("file.separator");
-  public static final char separatorChar = separator.charAt(0);
-  public static final String pathSeparator = System.getProperty("path.separator");
-  public static final char pathSeparatorChar = pathSeparator.charAt(0);
+
+  private static final String separator
+    = SystemProperties.getProperty("file.separator");
+
+  private static final char separatorChar = separator.charAt(0);
 
   /**
    * On most platforms 260 is equal or greater than a max path value,
@@ -58,35 +60,96 @@
    */
   public static final int INITIAL_MAX_PATH = 260/2;
 
+  private PlatformHelper() {} // Prohibits instantiation.
+
   /**
-   * This routine checks the input param "path" whether it begins with root path
-   * prefix.
-   * if not, return 0;
-   * if yes, return the len of root path prefix;
-   *   --for Unix-family platform, root path begins with "/" and len is 1
-   *   --for Windows platform, root path begins with "drive:\\" and len is 3
+   * This routine checks the input param "path" whether it begins with root
+   * path prefix. Note that even if a path begins with a root prefix, it may
+   * denote a relative path on some platforms (e.g., Windows). On the other
+   * hand, a root prefix may denote an absolute path's beginning but itself
+   * does not end with a file separator character.
+   *
+   * @return the length of root path's prefix (1 for Unix-family platforms
+   * and 1..3 (or more) for Windows platforms), or 0 if missing
    */
   public static final int beginWithRootPathPrefix(String path)
   {
-    if (path.startsWith("/") || path.startsWith("\\"))
-      return 1;
-
-    if (!isWindows)
+    int len = path.length();
+    if (len == 0)
       return 0;
 
-    if (path.length() > 2
-        && Character.isLetter(path.charAt(0))
-        && path.charAt(1) == ':'
-        && (path.charAt(2) == '/' || path.charAt(2) == '\\'))
-      return 3;
-
-    return 0;
+    if (separatorChar != '\\')
+      {
+        // Handle UNIX path.
+        return path.charAt(0) == separatorChar ? 1 : 0;
+      }
+
+    int pos = 0; // length of the prefix
+    // Handle Windows path.
+    if (path.charAt(0) == '\\')
+      {
+        pos = 1;
+        if (len != 1 && path.charAt(1) == '\\')
+          {
+            // Handle UNC path.
+            while (++pos < len)
+              if (path.charAt(pos) == '\\')
+                break;
+            if (pos < len)
+              {
+                char ch = '\0';
+                while (++pos < len)
+                  if ((ch = path.charAt(pos)) == '\\' || ch == ':')
+                    break;
+                if (pos < len)
+                  { // matches "\\server\share\" or "\\nwserver\volume:"
+                    pos++;
+                    if (ch == ':' && pos < len && path.charAt(pos) == '\\')
+                      pos++; // matches "\\nwserver\volume:\"
+                  }
+              }
+          }
+      }
+    else
+      {
+        pos = path.indexOf(':', 0) + 1;
+        if (pos > 1)
+          {
+            // Handle path starting with a drive prefix.
+            int i;
+            if (path.lastIndexOf('.', pos - 2) >= 0
+                || ((i = path.lastIndexOf('\\', pos - 2)) > 0
+                    && path.lastIndexOf('\\', i - 1) >= 0))
+              { // matches "file.ext:ntstream" or "path\dir\file:ntstream"
+                pos = 0;
+              }
+            else
+              {
+                if (pos < len)
+                  {
+                    if (path.charAt(pos) == '\\')
+                      pos++; // matches "d:\", "volume:\", "nwserver\volume:\"
+                    else
+                      {
+                        // Handle "Alternate data stream" name suffix.
+                        if (pos > 2 && path.indexOf(':', pos) < 0
+                            && path.indexOf('\\', pos + 1) < 0)
+                          pos = 0; // matches "file:ntstream"
+                      }
+                  }
+              }
+          }
+      }
+    return pos;
   }
 
   /**
    * This routine checks the input param "path" whether it's root directory.
-   *  --for Unix-family platform, root directory is "/"
-   *  --for Windows platform, root directory is "\\" or "drive:\\".
+   * For Unix-family platforms, the root directory is "/".
+   * For Windows platforms, the root directory is "\", "d:", "d:\" or
+   * "\\server\share\". For Novel NetWare clients, the root directory also
+   * could be in the format of "volume:", "volume:\", "nwserver\volume:",
+   * "nwserver\volume:\", "\\nwserver\volume:" or "\\nwserver\volume:\".
    */
   public static final boolean isRootDirectory(String path)
   {
@@ -99,10 +162,7 @@
    */
   public static final boolean endWithSeparator(String path)
   {
-    if (path.endsWith("\\") || path.endsWith("/"))
-      return true;
-
-    return false;
+    return path.endsWith(separator) || path.endsWith("/");
   }
 
   /**
@@ -123,7 +183,14 @@
    */
   public static final int lastIndexOfSeparator(String path)
   {
-    return Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));
+    int pos = path.lastIndexOf(separatorChar);
+    if (separatorChar != '/' && pos < path.length() - 1)
+      {
+        int pos2 = path.lastIndexOf('/');
+        if (pos <= pos2)
+          pos = pos2;
+      }
+    return pos;
   }
 
 }
