aboutsummaryrefslogtreecommitdiffstats
path: root/netx/net/sourceforge
diff options
context:
space:
mode:
authorAndrew Su <[email protected]>2011-05-25 14:50:42 -0400
committerAndrew Su <[email protected]>2011-05-25 14:50:42 -0400
commit82a43b48cba77a1e4fe108732838f32c710e8831 (patch)
tree9fb0c68981abd090814b21e3b7e018caf0abc852 /netx/net/sourceforge
parentf28f5be45b529a049673e4d77787753162d1f152 (diff)
Fix PR726. Create recently_used on startup.
Diffstat (limited to 'netx/net/sourceforge')
-rw-r--r--netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java19
1 files changed, 13 insertions, 6 deletions
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();