struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [10/12] git commit: Restored the ordering feature.
Date Thu, 21 Aug 2014 07:45:30 GMT
Restored the ordering feature.


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/c74f2836
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/c74f2836
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/c74f2836

Branch: refs/heads/develop
Commit: c74f283626ac0c08f66e52b6102fcaa3d6614903
Parents: be72010
Author: Luigi Fugaro <l.fugaro@gmail.com>
Authored: Mon Aug 18 16:25:42 2014 +0200
Committer: Luigi Fugaro <l.fugaro@gmail.com>
Committed: Mon Aug 18 16:25:42 2014 +0200

----------------------------------------------------------------------
 .../opensymphony/xwork2/util/LocalizedTextUtil.java  | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/c74f2836/xwork-core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
----------------------------------------------------------------------
diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
b/xwork-core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
index 3219450..9aad928 100644
--- a/xwork-core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
+++ b/xwork-core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
@@ -86,7 +86,7 @@ import java.util.concurrent.ConcurrentMap;
  */
 public class LocalizedTextUtil {
 
-    private static final ConcurrentMap<Integer, Set<String>> classLoaderMap =
new ConcurrentHashMap<Integer, Set<String>>();
+    private static final ConcurrentMap<Integer, List<String>> classLoaderMap
= new ConcurrentHashMap<Integer, List<String>>();
     private static final Logger LOG = LoggerFactory.getLogger(LocalizedTextUtil.class);
     private static boolean reloadBundles = false;
     private static final ConcurrentMap<String, ResourceBundle> bundlesMap = new ConcurrentHashMap<String,
ResourceBundle>();
@@ -106,9 +106,9 @@ public class LocalizedTextUtil {
      */
     public static void clearDefaultResourceBundles() {
         ClassLoader ccl = getCurrentThreadContextClassLoader();
-        Set<String> bundles = new HashSet<String>();
+        List<String> bundles = new ArrayList<String>();
         classLoaderMap.put(ccl.hashCode(), bundles);
-        bundles.add(XWORK_MESSAGES_BUNDLE);
+        bundles.add(0, XWORK_MESSAGES_BUNDLE);
     }
 
     /**
@@ -132,13 +132,14 @@ public class LocalizedTextUtil {
         ClassLoader ccl = null;
         synchronized (XWORK_MESSAGES_BUNDLE) {
             ccl = getCurrentThreadContextClassLoader();
-            Set<String> bundles = classLoaderMap.get(ccl.hashCode());
+            List<String> bundles = classLoaderMap.get(ccl.hashCode());
             if (bundles == null) {
-                bundles = new HashSet<String>();
+                bundles = new ArrayList<String>();
                 classLoaderMap.put(ccl.hashCode(), bundles);
                 bundles.add(XWORK_MESSAGES_BUNDLE);
             }
-            bundles.add(resourceBundleName);
+            bundles.remove(resourceBundleName);
+            bundles.add(0, resourceBundleName);
         }
 
         if (LOG.isDebugEnabled()) {
@@ -197,7 +198,7 @@ public class LocalizedTextUtil {
      * @return a localized message based on the specified key, or null if no localized message
can be found for it
      */
     public static String findDefaultText(String aTextName, Locale locale) {
-        Set<String> localList = classLoaderMap.get(getCurrentThreadContextClassLoader().hashCode());
+        List<String> localList = classLoaderMap.get(Thread.currentThread().getContextClassLoader().hashCode());
 
         for (String bundleName : localList) {
             ResourceBundle bundle = findResourceBundle(bundleName, locale);


Mime
View raw message