harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From regi...@apache.org
Subject svn commit: r895562 - in /harmony/enhanced/classlib/trunk/modules/luni/src: main/java/org/apache/harmony/luni/internal/io/FileCanonPathCache.java test/impl/common/org/apache/harmony/luni/tests/java/io/FileCanonPathCacheTest.java
Date Mon, 04 Jan 2010 04:58:49 GMT
Author: regisxu
Date: Mon Jan  4 04:58:33 2010
New Revision: 895562

URL: http://svn.apache.org/viewvc?rev=895562&view=rev
Log:
Apply patch for HARMONY-6414: [classlib][luni]FileCanonPathCache should remove the oldest
not the path, which is always the same one.

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/io/FileCanonPathCache.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/impl/common/org/apache/harmony/luni/tests/java/io/FileCanonPathCacheTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/io/FileCanonPathCache.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/io/FileCanonPathCache.java?rev=895562&r1=895561&r2=895562&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/io/FileCanonPathCache.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/io/FileCanonPathCache.java
Mon Jan  4 04:58:33 2010
@@ -85,7 +85,7 @@
                     String oldest = null;
                     do {
                         oldest = list.removeFirst();
-                        cache.remove(path);
+                        cache.remove(oldest);
                     } while (!path.equals(oldest));
                 }
             }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/impl/common/org/apache/harmony/luni/tests/java/io/FileCanonPathCacheTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/impl/common/org/apache/harmony/luni/tests/java/io/FileCanonPathCacheTest.java?rev=895562&r1=895561&r2=895562&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/impl/common/org/apache/harmony/luni/tests/java/io/FileCanonPathCacheTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/impl/common/org/apache/harmony/luni/tests/java/io/FileCanonPathCacheTest.java
Mon Jan  4 04:58:33 2010
@@ -95,6 +95,20 @@
         assertNull(FileCanonPathCache.get(file5.getAbsolutePath()));
     }
 
+    public void testTimeout03() throws Exception {
+        FileCanonPathCache.setTimeout(10);
+        File file = new File("1");
+        FileCanonPathCache.put(file.getAbsolutePath(), file.getAbsolutePath());
+        file = new File("2");
+        FileCanonPathCache.put(file.getAbsolutePath(), file.getAbsolutePath());
+        file = new File("3");
+        FileCanonPathCache.put(file.getAbsolutePath(), file.getAbsolutePath());
+        Thread.sleep(100);
+        FileCanonPathCache.get(file.getAbsolutePath());
+        assertNull(FileCanonPathCache.get(new File("1").getAbsolutePath()));
+        assertNull(FileCanonPathCache.get(new File("2").getAbsolutePath()));
+    }
+
     public void testCacheFull() throws Exception {
         int cacheSize = FileCanonPathCache.CACHE_SIZE;
         File[] files = new File[cacheSize];



Mime
View raw message