diff options
author | Andrew Su <[email protected]> | 2011-05-25 14:50:42 -0400 |
---|---|---|
committer | Andrew Su <[email protected]> | 2011-05-25 14:50:42 -0400 |
commit | 82a43b48cba77a1e4fe108732838f32c710e8831 (patch) | |
tree | 9fb0c68981abd090814b21e3b7e018caf0abc852 | |
parent | f28f5be45b529a049673e4d77787753162d1f152 (diff) |
Fix PR726. Create recently_used on startup.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java | 19 |
2 files changed, 19 insertions, 6 deletions
@@ -1,3 +1,9 @@ +2011-05-20 Andrew Su <[email protected]> + + * netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java: + (CacheLRUWrapper): New constructor to create file. + (lock): Removed creation of file here. + 2011-05-17 Jiri Vanek <[email protected]> * tests/junit-runner/JunitLikeXmlOutputListener: This listener exports diff --git a/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java b/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java index 2a91456..59ab00d 100644 --- a/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java +++ b/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java @@ -78,6 +78,18 @@ enum CacheLRUWrapper { private PropertiesFile cacheOrder = new PropertiesFile( new File(cacheDir + File.separator + "recently_used")); + private CacheLRUWrapper(){ + File f = cacheOrder.getStoreFile(); + if (!f.exists()) { + try { + FileUtils.createParentDir(f); + FileUtils.createRestrictedFile(f, true); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + /** * Returns an instance of the policy. * @@ -181,12 +193,7 @@ enum CacheLRUWrapper { */ public synchronized void lock() { try { - File f = cacheOrder.getStoreFile(); - if (!f.exists()) { - FileUtils.createParentDir(f); - FileUtils.createRestrictedFile(f, true); - } - fl = FileUtils.getFileLock(f.getPath(), false, true); + fl = FileUtils.getFileLock(cacheOrder.getStoreFile().getPath(), false, true); } catch (OverlappingFileLockException e) { // if overlap we just increase the count. } catch (Exception e) { // We didn't get a lock.. e.printStackTrace(); |