Mercurial > hg > release > icedtea-web-1.6
changeset 1168:a89fc59ab516
Changing enum CacheLRUWrapper singleton to instantiatible one. recently_used moved to PathsAndFiles.
* netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java: changed form enum to class. Added testing constructors. Fields encapsualted and made final.
* netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java:is now using PathsAndFiles.CACHE_DIR
* netx/net/sourceforge/jnlp/config/PathsAndFiles.java: defined CACHE_INDEX_FILE_NAME as recently_used and declared InfrastructureFileDescriptor RECENTLY_USED_FILE
* netx/net/sourceforge/jnlp/controlpanel/CachePane.java: moved to PathsAndFiles
* netx/net/sourceforge/jnlp/resources/Messages.properties: added description of RECENTLY_USED_FILE, FILErecentlyUsed
* tests/netx/unit/net/sourceforge/jnlp/cache/CacheLRUWrapperTest.java: now using fake instance
* tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java:same + fixed
author | Jiri Vanek <jvanek@redhat.com> |
---|---|
date | Tue, 03 Mar 2015 17:04:24 +0100 |
parents | d0e2beda96ca |
children | 8cae163ee8bd |
files | ChangeLog netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java netx/net/sourceforge/jnlp/config/PathsAndFiles.java netx/net/sourceforge/jnlp/controlpanel/CachePane.java netx/net/sourceforge/jnlp/resources/Messages.properties tests/netx/unit/net/sourceforge/jnlp/cache/CacheLRUWrapperTest.java tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java |
diffstat | 8 files changed, 142 insertions(+), 90 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Mar 03 15:33:27 2015 +0100 +++ b/ChangeLog Tue Mar 03 17:04:24 2015 +0100 @@ -1,4 +1,21 @@ -2015-02-27 Jiri Vanek <jvanek@redhat.com> +2015-03-03 Jiri Vanek <jvanek@redhat.com> + + Changing enum CacheLRUWrapper singleton to instantiatible one. recently_used + moved to PathsAndFiles. + * netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java: changed form enum to + class. Added testing constructors. Fields encapsualted and made final. + * netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java:is now using + PathsAndFiles.CACHE_DIR + * netx/net/sourceforge/jnlp/config/PathsAndFiles.java: defined CACHE_INDEX_FILE_NAME + as recently_used and declared InfrastructureFileDescriptor RECENTLY_USED_FILE + * netx/net/sourceforge/jnlp/controlpanel/CachePane.java: moved to PathsAndFiles + * netx/net/sourceforge/jnlp/resources/Messages.properties: added description + of RECENTLY_USED_FILE, FILErecentlyUsed + * tests/netx/unit/net/sourceforge/jnlp/cache/CacheLRUWrapperTest.java: now using + fake instance + * tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java: + same + fixed +2015-03-03 Jiri Vanek <jvanek@redhat.com> Fixed CacheReproducerTest and VersionedJarTest tests * tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java:
--- a/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java Tue Mar 03 15:33:27 2015 +0100 +++ b/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java Tue Mar 03 17:04:24 2015 +0100 @@ -49,8 +49,7 @@ import java.util.Map.Entry; import java.util.Set; -import net.sourceforge.jnlp.config.DeploymentConfiguration; -import net.sourceforge.jnlp.runtime.JNLPRuntime; +import net.sourceforge.jnlp.config.PathsAndFiles; import net.sourceforge.jnlp.util.FileUtils; import net.sourceforge.jnlp.util.PropertiesFile; import net.sourceforge.jnlp.util.logging.OutputController; @@ -59,33 +58,44 @@ * This class helps maintain the ordering of most recently use items across * multiple jvm instances. * - * @author <a href="mailto:Andrew%20Su%20<asu@redhat.com>">Andrew Su (asu@redhat.com</a>, <a href="mailto:Andrew%20Su%20<andrew.su@utoronto.ca>">andrew.su@utoronto.ca)</a> - * */ -public enum CacheLRUWrapper { - INSTANCE; - - /* location of cache directory */ - private final String setCachePath = JNLPRuntime.getConfiguration().getProperty(DeploymentConfiguration.KEY_USER_CACHE_DIR); - String cacheDir = new File(setCachePath != null ? setCachePath : System.getProperty("java.io.tmpdir")).getPath(); - +public class CacheLRUWrapper { + /* * back-end of how LRU is implemented This file is to keep track of the most * recently used items. The items are to be kept with key = (current time * accessed) followed by folder of item. value = path to file. */ - - public static final String CACHE_INDEX_FILE_NAME = "recently_used"; - - PropertiesFile cacheOrder = new PropertiesFile( - new File(cacheDir + File.separator + CACHE_INDEX_FILE_NAME)); + + private final PropertiesFile recentlyUsedPropertiesFile; + private final File cacheDir; + private final File recentlyUsedFile; - private CacheLRUWrapper() { - File f = cacheOrder.getStoreFile(); - if (!f.exists()) { + public CacheLRUWrapper() { + this(PathsAndFiles.RECENTLY_USED_FILE.getFile()); + } + + /** + * testing constructor + * @param recentlyUsed file to be used as recently_used file. its parent will be used as cache dir + */ + public CacheLRUWrapper(final File recentlyUsed) { + this(recentlyUsed, recentlyUsed.getParentFile()); + } + + /** + * testing constructor + * @param recentlyUsed file to be used as recently_used file + * @param cacheDir dir with cache + */ + public CacheLRUWrapper(final File recentlyUsed, final File cacheDir) { + recentlyUsedPropertiesFile = new PropertiesFile(recentlyUsed); + recentlyUsedFile = recentlyUsed; + this.cacheDir = cacheDir; + if (!recentlyUsed.exists()) { try { - FileUtils.createParentDir(f); - FileUtils.createRestrictedFile(f, true); + FileUtils.createParentDir(recentlyUsed); + FileUtils.createRestrictedFile(recentlyUsed, true); } catch (IOException e) { OutputController.getLogger().log(OutputController.Level.ERROR_ALL, e); } @@ -98,14 +108,39 @@ * @return an instance of the policy */ public static CacheLRUWrapper getInstance() { - return INSTANCE; + return CacheLRUWrapperHolder.INSTANCE; + } + + /** + * @return the recentlyUsedPropertiesFile + */ + public PropertiesFile getRecentlyUsedPropertiesFile() { + return recentlyUsedPropertiesFile; } /** + * @return the cacheDir + */ + public File getCacheDir() { + return cacheDir; + } + + /** + * @return the recentlyUsedFile + */ + public File getRecentlyUsedFile() { + return recentlyUsedFile; + } + + private static class CacheLRUWrapperHolder{ + private static final CacheLRUWrapper INSTANCE = new CacheLRUWrapper(); + } + + /** * Update map for keeping track of recently used items. */ public synchronized void load() { - boolean loaded = cacheOrder.load(); + boolean loaded = getRecentlyUsedPropertiesFile().load(); /* * clean up possibly corrupted entries */ @@ -118,13 +153,13 @@ } /** - * check content of cacheOrder and remove invalid/corrupt entries + * check content of recentlyUsedPropertiesFile and remove invalid/corrupt entries * * @return true, if cache was corrupted and affected entry removed */ private boolean checkData () { boolean modified = false; - Set<Entry<Object, Object>> q = cacheOrder.entrySet(); + Set<Entry<Object, Object>> q = getRecentlyUsedPropertiesFile().entrySet(); for (Iterator<Entry<Object, Object>> it = q.iterator(); it.hasNext();) { Entry<Object, Object> currentEntry = it.next(); @@ -144,7 +179,7 @@ // 2. check path format - does the path look correct? if (path != null) { - if (path.indexOf(cacheDir) < 0) { + if (!path.contains(cacheDir.getAbsolutePath())) { it.remove(); modified = true; } @@ -161,8 +196,8 @@ * Write file to disk. */ public synchronized boolean store() { - if (cacheOrder.isHeldByCurrentThread()) { - cacheOrder.store(); + if (getRecentlyUsedPropertiesFile().isHeldByCurrentThread()) { + getRecentlyUsedPropertiesFile().store(); return true; } return false; @@ -176,10 +211,10 @@ * @return true if we successfully added to map, false otherwise. */ public synchronized boolean addEntry(String key, String path) { - if (cacheOrder.containsKey(key)) { + if (getRecentlyUsedPropertiesFile().containsKey(key)) { return false; } - cacheOrder.setProperty(key, path); + getRecentlyUsedPropertiesFile().setProperty(key, path); return true; } @@ -190,15 +225,15 @@ * @return true if we successfully removed key from map, false otherwise. */ public synchronized boolean removeEntry(String key) { - if (!cacheOrder.containsKey(key)) { + if (!recentlyUsedPropertiesFile.containsKey(key)) { return false; } - cacheOrder.remove(key); + getRecentlyUsedPropertiesFile().remove(key); return true; } private String getIdForCacheFolder(String folder) { - int len = cacheDir.length(); + int len = getCacheDir().getAbsolutePath().length(); int index = folder.indexOf(File.separatorChar, len + 1); return folder.substring(len + 1, index); } @@ -210,12 +245,12 @@ * @return true if we successfully updated value, false otherwise. */ public synchronized boolean updateEntry(String oldKey) { - if (!cacheOrder.containsKey(oldKey)) return false; - String value = cacheOrder.getProperty(oldKey); + if (!recentlyUsedPropertiesFile.containsKey(oldKey)) return false; + String value = getRecentlyUsedPropertiesFile().getProperty(oldKey); String folder = getIdForCacheFolder(value); - cacheOrder.remove(oldKey); - cacheOrder.setProperty(Long.toString(System.currentTimeMillis()) + "," + folder, value); + getRecentlyUsedPropertiesFile().remove(oldKey); + getRecentlyUsedPropertiesFile().setProperty(Long.toString(System.currentTimeMillis()) + "," + folder, value); return true; } @@ -230,7 +265,7 @@ public synchronized List<Entry<String, String>> getLRUSortedEntries() { List<Entry<String, String>> entries = new ArrayList<>(); - for (Entry e : cacheOrder.entrySet()) { + for (Entry e : getRecentlyUsedPropertiesFile().entrySet()) { entries.add(new AbstractMap.SimpleImmutableEntry<String, String>(e)); } @@ -252,14 +287,14 @@ * Lock the file to have exclusive access. */ public synchronized void lock() { - cacheOrder.lock(); + getRecentlyUsedPropertiesFile().lock(); } /** * Unlock the file. */ public synchronized void unlock() { - cacheOrder.unlock(); + getRecentlyUsedPropertiesFile().unlock(); } /** @@ -269,15 +304,15 @@ * @return value of given key, null otherwise. */ public synchronized String getValue(String key) { - return cacheOrder.getProperty(key); + return getRecentlyUsedPropertiesFile().getProperty(key); } public synchronized boolean containsKey(String key) { - return cacheOrder.containsKey(key); + return getRecentlyUsedPropertiesFile().containsKey(key); } public synchronized boolean containsValue(String value) { - return cacheOrder.containsValue(value); + return getRecentlyUsedPropertiesFile().containsValue(value); } /** @@ -292,6 +327,6 @@ } void clearLRUSortedEntries() { - cacheOrder.clear(); + getRecentlyUsedPropertiesFile().clear(); } }
--- a/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java Tue Mar 03 15:33:27 2015 +0100 +++ b/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java Tue Mar 03 17:04:24 2015 +0100 @@ -43,7 +43,6 @@ import javax.naming.ConfigurationException; import javax.swing.JOptionPane; -import net.sourceforge.jnlp.cache.CacheLRUWrapper; import net.sourceforge.jnlp.runtime.JNLPRuntime; import net.sourceforge.jnlp.util.FileUtils; import net.sourceforge.jnlp.util.logging.OutputController; @@ -757,12 +756,12 @@ errors += moveLegacyToCurrent(legacySecurity, currentSecurity); String legacyCache = LEGACY_USER_HOME + File.separator + "cache"; - String currentCache = Defaults.getDefaults().get(DeploymentConfiguration.KEY_USER_CACHE_DIR).getDefaultValue(); + String currentCache = PathsAndFiles.CACHE_DIR.getFullPath(); errors += moveLegacyToCurrent(legacyCache, currentCache); - OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, "Adapting " + CacheLRUWrapper.CACHE_INDEX_FILE_NAME + " to new destination"); + OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, "Adapting " + PathsAndFiles.CACHE_INDEX_FILE_NAME + " to new destination"); //replace all legacyCache by currentCache in new recently_used try { - File f = new File(currentCache, CacheLRUWrapper.CACHE_INDEX_FILE_NAME); + File f = PathsAndFiles.RECENTLY_USED_FILE.getFile(); String s = FileUtils.loadFileAsString(f); s = s.replace(legacyCache, currentCache); FileUtils.saveFile(s, f);
--- a/netx/net/sourceforge/jnlp/config/PathsAndFiles.java Tue Mar 03 15:33:27 2015 +0100 +++ b/netx/net/sourceforge/jnlp/config/PathsAndFiles.java Tue Mar 03 17:04:24 2015 +0100 @@ -68,6 +68,7 @@ private static final String USER_PROP = "user.name"; private static final String VARIABLE = JNLPRuntime.isWindows() ? "%" : "$"; public static final String ICEDTEA_SO = "IcedTeaPlugin.so"; + public static final String CACHE_INDEX_FILE_NAME = "recently_used"; static { String configHome = System.getProperty(HOME_PROP) + File.separator + ".config"; @@ -115,6 +116,7 @@ public static final InfrastructureFileDescriptor OPERA_32 = new InfrastructureFileDescriptor(ICEDTEA_SO, "/usr/lib/opera/plugins/", "", "FILEopera32", Target.PLUGIN); public static final InfrastructureFileDescriptor CACHE_DIR = new ItwCacheFileDescriptor("cache", "FILEcache", Target.JAVAWS, Target.ITWEB_SETTINGS); + public static final InfrastructureFileDescriptor RECENTLY_USED_FILE = new ItwCacheFileDescriptor(CACHE_INDEX_FILE_NAME, CACHE_DIR.getFile().getName(), "FILErecentlyUsed", Target.JAVAWS, Target.ITWEB_SETTINGS); public static final InfrastructureFileDescriptor PCACHE_DIR = new ItwCacheFileDescriptor("pcache", "FILEappdata", Target.JAVAWS, Target.ITWEB_SETTINGS); public static final InfrastructureFileDescriptor LOG_DIR = new ItwConfigFileDescriptor("log", "FILElogs", Target.JAVAWS, Target.ITWEB_SETTINGS); //javaws is saving here, itweb-settings may modify them
--- a/netx/net/sourceforge/jnlp/controlpanel/CachePane.java Tue Mar 03 15:33:27 2015 +0100 +++ b/netx/net/sourceforge/jnlp/controlpanel/CachePane.java Tue Mar 03 17:04:24 2015 +0100 @@ -58,10 +58,10 @@ import javax.swing.table.TableRowSorter; import net.sourceforge.jnlp.cache.CacheDirectory; -import net.sourceforge.jnlp.cache.CacheLRUWrapper; import net.sourceforge.jnlp.cache.CacheUtil; import net.sourceforge.jnlp.cache.DirectoryNode; import net.sourceforge.jnlp.config.DeploymentConfiguration; +import net.sourceforge.jnlp.config.PathsAndFiles; import net.sourceforge.jnlp.runtime.Translator; import net.sourceforge.jnlp.util.FileUtils; import net.sourceforge.jnlp.util.PropertiesFile; @@ -71,7 +71,7 @@ public class CachePane extends JPanel { JDialog parent; DeploymentConfiguration config; - private String location; + private final String location; private JComponent defaultFocusComponent; DirectoryNode root; String[] columns = { @@ -323,7 +323,7 @@ } private void updateRecentlyUsed(File f) { - File recentlyUsedFile = new File(location + File.separator + CacheLRUWrapper.CACHE_INDEX_FILE_NAME); + File recentlyUsedFile = PathsAndFiles.RECENTLY_USED_FILE.getFile(); PropertiesFile pf = new PropertiesFile(recentlyUsedFile); pf.load(); Enumeration<Object> en = pf.keys();
--- a/netx/net/sourceforge/jnlp/resources/Messages.properties Tue Mar 03 15:33:27 2015 +0100 +++ b/netx/net/sourceforge/jnlp/resources/Messages.properties Tue Mar 03 17:04:24 2015 +0100 @@ -1034,6 +1034,7 @@ FILEopera32=Location of plugin library for global purposes on opera compliant browser, 32b systems. FILEcache=Contains cached runtime entries (and my be changed by you). +FILErecentlyUsed=Additional information about items in cache FILEappdata=Contains saved application data. FILElogs=(may be set to different location by you) contains file log files (if enabled). itw-cplugin-date_time.log for native part of plugin, itw-javantx-date_time.log for everything else. FILEicons=Location where icons of javaws applications desktp/menu launchers icons are stored
--- a/tests/netx/unit/net/sourceforge/jnlp/cache/CacheLRUWrapperTest.java Tue Mar 03 15:33:27 2015 +0100 +++ b/tests/netx/unit/net/sourceforge/jnlp/cache/CacheLRUWrapperTest.java Tue Mar 03 17:04:24 2015 +0100 @@ -46,42 +46,43 @@ import java.io.PrintStream; import java.util.concurrent.CountDownLatch; -import org.junit.AfterClass; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import net.sourceforge.jnlp.ServerAccess; +import net.sourceforge.jnlp.config.PathsAndFiles; import net.sourceforge.jnlp.util.CacheTestUtils; -import net.sourceforge.jnlp.util.PropertiesFile; public class CacheLRUWrapperTest { - private static final CacheLRUWrapper clw = CacheLRUWrapper.getInstance(); - private static String cacheDirBackup; - private static PropertiesFile cacheOrderBackup; // does no DeploymentConfiguration exist for this file name? - private static final String cacheIndexFileName = CacheLRUWrapper.CACHE_INDEX_FILE_NAME + "_testing"; + private static final String cacheIndexFileName = PathsAndFiles.CACHE_INDEX_FILE_NAME + "_testing"; + private static final File javaTmp = new File(System.getProperty("java.io.tmpdir")); + private static final File tmpCache; + + static { + try { + tmpCache = File.createTempFile("itw", "CacheLRUWrapperTest", javaTmp); + tmpCache.delete(); + tmpCache.mkdir(); + tmpCache.deleteOnExit(); + if (!tmpCache.isDirectory()) { + throw new IOException("Unsuccess to create tmpfile, remove it and createsame directory"); + } + + } catch (IOException ex) { + throw new RuntimeException(ex); + } + + } + private static final CacheLRUWrapper clw = new CacheLRUWrapper(new File(tmpCache, cacheIndexFileName)); private final int noEntriesCacheFile = 1000; private ByteArrayOutputStream baos; private PrintStream out; - @BeforeClass - static public void setupJNLPRuntimeConfig() { - cacheDirBackup = clw.cacheDir; - cacheOrderBackup = clw.cacheOrder; - clw.cacheDir=System.getProperty("java.io.tmpdir"); - clw.cacheOrder = new PropertiesFile( new File(clw.cacheDir + File.separator + cacheIndexFileName)); - - } - - @AfterClass - static public void restoreJNLPRuntimeConfig() { - clw.cacheDir = cacheDirBackup; - clw.cacheOrder = cacheOrderBackup; - } + @Before public void setup() { @@ -92,7 +93,7 @@ @Test public void testLoadStoreTiming() throws InterruptedException { - final File cacheIndexFile = new File(clw.cacheDir + File.separator + cacheIndexFileName); + final File cacheIndexFile = clw.getRecentlyUsedFile(); cacheIndexFile.delete(); try { int noLoops = 1000; @@ -133,7 +134,7 @@ // fill cache index file for(int i = 0; i < noEntries; i++) { - String path = clw.cacheDir + File.separatorChar + i + File.separatorChar + "test" + i + ".jar"; + String path = clw.getRecentlyUsedFile().getAbsolutePath() + File.separatorChar + i + File.separatorChar + "test" + i + ".jar"; String key = clw.generateKey(path); clw.addEntry(key, path); } @@ -142,7 +143,7 @@ @Test public void testModTimestampAfterStore() throws InterruptedException { - final File cacheIndexFile = new File(clw.cacheDir + File.separator + cacheIndexFileName); + final File cacheIndexFile = clw.getRecentlyUsedFile(); cacheIndexFile.delete(); try{ clw.lock(); @@ -214,7 +215,7 @@ public void testLock() throws IOException { try { clw.lock(); - assertTrue(clw.cacheOrder.isHeldByCurrentThread()); + assertTrue(clw.getRecentlyUsedPropertiesFile().isHeldByCurrentThread()); } finally { clw.unlock(); } @@ -227,7 +228,7 @@ } finally { clw.unlock(); } - assertTrue(!clw.cacheOrder.isHeldByCurrentThread()); + assertTrue(!clw.getRecentlyUsedPropertiesFile().isHeldByCurrentThread()); } @Test(timeout = 2000l) @@ -280,7 +281,7 @@ @Override public void run() { try { - clw.cacheOrder.tryLock(); + clw.getRecentlyUsedPropertiesFile().tryLock(); boolean result = clw.store(); synchronized (out) { out.println(String.valueOf(result));
--- a/tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java Tue Mar 03 15:33:27 2015 +0100 +++ b/tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java Tue Mar 03 17:04:24 2015 +0100 @@ -44,13 +44,11 @@ import java.io.UnsupportedEncodingException; import java.util.Arrays; import java.util.List; -import java.util.PropertyResourceBundle; import java.util.regex.Matcher; import java.util.regex.Pattern; import net.sourceforge.jnlp.ServerAccess; import net.sourceforge.jnlp.ProcessResult; import net.sourceforge.jnlp.annotations.KnownToFail; -import net.sourceforge.jnlp.config.Defaults; import net.sourceforge.jnlp.config.PathsAndFiles; import net.sourceforge.jnlp.tools.MessageProperties; import org.junit.AfterClass; @@ -70,13 +68,12 @@ private static final Pattern corruptPatern = Pattern.compile(corruptRegex); private static final String corruptString = "156dsf1562kd5"; - private static final File icedteaCache = new File(PathsAndFiles.USER_CACHE_HOME, "cache"); - private static final File icedteaCacheFile = new File(icedteaCache, "recently_used"); - private static final File netxLock = new File(System.getProperty("java.io.tmpdir"), - System.getProperty("user.name") + File.separator + - "netx" + File.separator + - "locks" + File.separator + - "netx_running"); + //recently.used is always here + private static final int PERMANENT_FILES = 1; + + private static final File icedteaCache = PathsAndFiles.CACHE_DIR.getFile(); + private static final File icedteaCacheFile = PathsAndFiles.RECENTLY_USED_FILE.getFile(); + private static final File netxLock = PathsAndFiles.MAIN_LOCK.getFile(); String testS = "#netx file\n" + "#Mon Dec 12 16:20:46 CET 2011\n" @@ -142,7 +139,7 @@ private void assertCacheIsNotEmpty() { Assert.assertTrue("icedtea cache " + icedteaCache.getAbsolutePath() + " should exist some any run", icedteaCache.exists()); Assert.assertTrue("icedtea cache file " + icedteaCacheFile.getAbsolutePath() + " should exist some any run", icedteaCacheFile.exists()); - Assert.assertTrue("icedtea cache file " + icedteaCacheFile.getAbsolutePath() + " should not be empty", icedteaCacheFile.length() > 0); + Assert.assertTrue("icedtea cache file " + icedteaCacheFile.getAbsolutePath() + " should not be empty", icedteaCacheFile.length() > PERMANENT_FILES); } /** @@ -346,7 +343,7 @@ } tryToClearcache(); - Assert.assertTrue("icedtea cache " + icedteaCache.getAbsolutePath() + " should be empty after clearing", icedteaCache.listFiles().length == 0); + Assert.assertTrue("icedtea cache " + icedteaCache.getAbsolutePath() + " should be empty after clearing", icedteaCache.listFiles().length == PERMANENT_FILES); } private static String loadFile(File f) throws FileNotFoundException, UnsupportedEncodingException, IOException {