You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by li...@apache.org on 2007/01/31 09:18:56 UTC

svn commit: r501761 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java

Author: liangyx
Date: Wed Jan 31 00:18:56 2007
New Revision: 501761

URL: http://svn.apache.org/viewvc?view=rev&rev=501761
Log:
Apply patch for HARMONY-3092([classlib][luni] File.calculatePath() generates unnecessary strings)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java?view=diff&rev=501761&r1=501760&r2=501761
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java Wed Jan 31 00:18:56 2007
@@ -168,8 +168,14 @@
         if (!name.equals("")) { //$NON-NLS-1$
             // Remove all the proceeding separator chars from name
             name = fixSlashes(name);
-            while (name.length() > 0 && (name.charAt(0) == separatorChar)) {
-                name = name.substring(1, name.length());
+
+            int separatorIndex = 0;
+            while ((separatorIndex < name.length())
+                    && (name.charAt(separatorIndex) == separatorChar)) {
+                separatorIndex++;
+            }
+            if (separatorIndex > 0) {
+                name = name.substring(separatorIndex, name.length());
             }
 
             // Ensure there is a separator char between dirPath and name