/hg/icedtea-web: Fix for duplicate entries in CacheLRUWrapper

jkang at icedtea.classpath.org jkang at icedtea.classpath.org
Mon Sep 15 14:11:22 UTC 2014


changeset 11ebb7204bdc in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=11ebb7204bdc
author: Jie Kang <jkang at redhat.com>
date: Mon Sep 15 10:10:44 2014 -0400

	Fix for duplicate entries in CacheLRUWrapper

	2014-09-15  Jie Kang  <jkang at redhat.com>

	    * netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java
	    (getLRUSortedEntries): now creates a deeper copy of cacheOrder list


diffstat:

 ChangeLog                                            |  5 +++++
 netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java |  8 +++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)

diffs (37 lines):

diff -r 90faf53bb981 -r 11ebb7204bdc ChangeLog
--- a/ChangeLog	Sat Sep 13 13:23:26 2014 -0400
+++ b/ChangeLog	Mon Sep 15 10:10:44 2014 -0400
@@ -1,3 +1,8 @@
+2014-09-15  Jie Kang  <jkang at redhat.com>
+
+    * netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java
+    (getLRUSortedEntries): now creates a deeper copy of cacheOrder list
+
 2014-09-13  Andrew Azores  <aazores at redhat.com>
 
 	* netx/net/sourceforge/jnlp/resources/Messages.properties
diff -r 90faf53bb981 -r 11ebb7204bdc netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java
--- a/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java	Sat Sep 13 13:23:26 2014 -0400
+++ b/netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java	Mon Sep 15 10:10:44 2014 -0400
@@ -40,6 +40,7 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.util.AbstractMap;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
@@ -227,7 +228,12 @@
     //although Properties are pretending to be <object,Object> they are always <String,String>
     //bug in jdk?
     public synchronized List<Entry<String, String>> getLRUSortedEntries() {
-        List<Entry<String, String>> entries = new ArrayList(cacheOrder.entrySet());
+        List<Entry<String, String>> entries = new ArrayList<>();
+
+        for (Entry e : cacheOrder.entrySet()) {
+            entries.add(new AbstractMap.SimpleImmutableEntry<String, String>(e));
+        }
+
         // sort by keys in descending order.
         Collections.sort(entries, new Comparator<Entry<String, String>>() {
             @Override


More information about the distro-pkg-dev mailing list