/hg/release/icedtea-web-1.1: Fix PR726. Create recently_used on ...

asu at icedtea.classpath.org asu at icedtea.classpath.org
Wed May 25 11:51:38 PDT 2011


changeset 06e542ca50c3 in /hg/release/icedtea-web-1.1
details: http://icedtea.classpath.org/hg/release/icedtea-web-1.1?cmd=changeset;node=06e542ca50c3
author: Andrew Su <asu at redhat.com>
date: Wed May 25 14:52:30 2011 -0400

	Fix PR726. Create recently_used on startup.


diffstat:

 ChangeLog                                            |   6 ++++++
 netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java |  19 +++++++++++++------
 2 files changed, 19 insertions(+), 6 deletions(-)

diffs (49 lines):

diff -r 85cf7fb25642 -r 06e542ca50c3 ChangeLog
--- a/ChangeLog	Tue May 10 11:59:47 2011 -0400
+++ b/ChangeLog	Wed May 25 14:52:30 2011 -0400
@@ -1,3 +1,9 @@
+2011-05-20  Andrew Su  <asu at redhat.com>
+
+	* netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java:
+	(CacheLRUWrapper): New constructor to create file.
+	(lock): Removed creation of file here.
+
 2011-05-10  Andrew Su  <asu at redhat.com>
 
 	* netx/net/sourceforge/jnlp/controlpanel/CachePane.java:
diff -r 85cf7fb25642 -r 06e542ca50c3 netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java
--- a/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java	Tue May 10 11:59:47 2011 -0400
+++ b/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java	Wed May 25 14:52:30 2011 -0400
@@ -78,6 +78,18 @@
     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 @@
      */
     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();



More information about the distro-pkg-dev mailing list