harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lian...@apache.org
Subject svn commit: r501761 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java
Date Wed, 31 Jan 2007 08:18:56 GMT
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



Mime
View raw message