From 3b596abbf0bea7954b32a6104ddf65ab4000dbdd Mon Sep 17 00:00:00 2001 From: Andrew Su Date: Fri, 27 May 2011 12:32:52 -0400 Subject: Fix PR727: Split conditional to removed duplicate entries in cache. --- netx/net/sourceforge/jnlp/cache/CacheUtil.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'netx/net/sourceforge') diff --git a/netx/net/sourceforge/jnlp/cache/CacheUtil.java b/netx/net/sourceforge/jnlp/cache/CacheUtil.java index a307a11..b88c6e9 100644 --- a/netx/net/sourceforge/jnlp/cache/CacheUtil.java +++ b/netx/net/sourceforge/jnlp/cache/CacheUtil.java @@ -567,6 +567,11 @@ public class CacheUtil { rStr = cacheDir + rStr.substring(0, rStr.indexOf(File.separatorChar, 1)); long len = file.length(); + if (keep.contains(file.getPath().substring(rStr.length()))) { + lruHandler.removeEntry(key); + continue; + } + /* * we remove entries from our lru if any of the following condition is met. * Conditions: @@ -574,11 +579,8 @@ public class CacheUtil { * - !file.isFile(): if someone tampered with the directory, file doesn't exist. * - maxSize >= 0 && curSize + len > maxSize: If a limit was set and the new size * on disk would exceed the maximum size. - * - keep.contains(...): We had already decided to keep an entry with the same - * url path. */ - if (delete || !file.isFile() || (maxSize >= 0 && curSize + len > maxSize) || - keep.contains(file.getPath().substring(rStr.length()))) { + if (delete || !file.isFile() || (maxSize >= 0 && curSize + len > maxSize)) { lruHandler.removeEntry(key); remove.add(rStr); } else { -- cgit v1.2.3