You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2014/08/21 09:45:26 UTC
[06/12] git commit: Updates as stated in PR#20 comments.
Updates as stated in PR#20 comments.
Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/da9afaf8
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/da9afaf8
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/da9afaf8
Branch: refs/heads/develop
Commit: da9afaf84e367f0e195cc8f221778eb798595fb6
Parents: 00f424a
Author: Luigi Fugaro <l....@gmail.com>
Authored: Wed Jul 30 14:29:03 2014 +0200
Committer: Luigi Fugaro <l....@gmail.com>
Committed: Wed Jul 30 14:29:03 2014 +0200
----------------------------------------------------------------------
.../opensymphony/xwork2/util/LocalizedTextUtil.java | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/struts/blob/da9afaf8/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 953c6b2..4e9d4eb 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, List<String>> classLoaderMap = new ConcurrentHashMap<Integer, List<String>>();
+ private static final ConcurrentMap<Integer, Set<String>> classLoaderMap = new ConcurrentHashMap<Integer, Set<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();
- List<String> bundles = new ArrayList<String>();
+ Set<String> bundles = new HashSet<String>();
classLoaderMap.put(ccl.hashCode(), bundles);
- bundles.add(0, XWORK_MESSAGES_BUNDLE);
+ bundles.add(XWORK_MESSAGES_BUNDLE);
}
/**
@@ -132,14 +132,13 @@ public class LocalizedTextUtil {
ClassLoader ccl = null;
synchronized (classLoaderMap) {
ccl = getCurrentThreadContextClassLoader();
- List<String> bundles = classLoaderMap.get(ccl.hashCode());
+ Set<String> bundles = classLoaderMap.get(ccl.hashCode());
if (bundles == null) {
- bundles = new ArrayList<String>();
+ bundles = new HashSet<String>();
classLoaderMap.put(ccl.hashCode(), bundles);
bundles.add(XWORK_MESSAGES_BUNDLE);
}
- bundles.remove(resourceBundleName);
- bundles.add(0, resourceBundleName);
+ bundles.add(resourceBundleName);
}
if (LOG.isDebugEnabled()) {
@@ -198,7 +197,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) {
- List<String> localList = classLoaderMap.get(getCurrentThreadContextClassLoader().hashCode());
+ Set<String> localList = classLoaderMap.get(getCurrentThreadContextClassLoader().hashCode());
for (String bundleName : localList) {
ResourceBundle bundle = findResourceBundle(bundleName, locale);