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 2016/01/26 10:59:58 UTC

[1/2] struts git commit: WW-4575 Adds missing constants translation

Repository: struts
Updated Branches:
  refs/heads/support-2-3 18bdc141e -> 15c79e139


WW-4575 Adds missing constants translation


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

Branch: refs/heads/support-2-3
Commit: dd369465732dfffdac6fb7cbc8ca83fee22b79f1
Parents: 18bdc14
Author: Lukasz Lenart <lu...@apache.org>
Authored: Tue Jan 26 10:00:21 2016 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Tue Jan 26 10:00:21 2016 +0100

----------------------------------------------------------------------
 core/src/main/java/org/apache/struts2/StrutsConstants.java          | 1 +
 .../org/apache/struts2/config/DefaultBeanSelectionProvider.java     | 1 +
 2 files changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/dd369465/core/src/main/java/org/apache/struts2/StrutsConstants.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/StrutsConstants.java b/core/src/main/java/org/apache/struts2/StrutsConstants.java
index 4671eb1..619ed66 100644
--- a/core/src/main/java/org/apache/struts2/StrutsConstants.java
+++ b/core/src/main/java/org/apache/struts2/StrutsConstants.java
@@ -287,6 +287,7 @@ public final class StrutsConstants {
     /** Comma delimited set of excluded classes and package names which cannot be accessed via expressions **/
     public static final String STRUTS_EXCLUDED_CLASSES = "struts.excludedClasses";
     public static final String STRUTS_EXCLUDED_PACKAGE_NAME_PATTERNS = "struts.excludedPackageNamePatterns";
+    public static final String STRUTS_EXCLUDED_PACKAGE_NAMES = "struts.excludedPackageNames";
 
     /** Dedicated services to check if passed string is excluded/accepted **/
     public static final String STRUTS_EXCLUDED_PATTERNS_CHECKER = "struts.excludedPatterns.checker";

http://git-wip-us.apache.org/repos/asf/struts/blob/dd369465/core/src/main/java/org/apache/struts2/config/DefaultBeanSelectionProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/config/DefaultBeanSelectionProvider.java b/core/src/main/java/org/apache/struts2/config/DefaultBeanSelectionProvider.java
index 3a6deb2..77f0070 100644
--- a/core/src/main/java/org/apache/struts2/config/DefaultBeanSelectionProvider.java
+++ b/core/src/main/java/org/apache/struts2/config/DefaultBeanSelectionProvider.java
@@ -422,6 +422,7 @@ public class DefaultBeanSelectionProvider extends AbstractBeanSelectionProvider
 
         convertIfExist(props, StrutsConstants.STRUTS_EXCLUDED_CLASSES, XWorkConstants.OGNL_EXCLUDED_CLASSES);
         convertIfExist(props, StrutsConstants.STRUTS_EXCLUDED_PACKAGE_NAME_PATTERNS, XWorkConstants.OGNL_EXCLUDED_PACKAGE_NAME_PATTERNS);
+        convertIfExist(props, StrutsConstants.STRUTS_EXCLUDED_PACKAGE_NAMES, XWorkConstants.OGNL_EXCLUDED_PACKAGE_NAMES);
 
         convertIfExist(props, StrutsConstants.STRUTS_ADDITIONAL_EXCLUDED_PATTERNS, XWorkConstants.ADDITIONAL_EXCLUDED_PATTERNS);
         convertIfExist(props, StrutsConstants.STRUTS_ADDITIONAL_ACCEPTED_PATTERNS, XWorkConstants.ADDITIONAL_ACCEPTED_PATTERNS);


[2/2] struts git commit: WW-4587 Adds logic to cache missing bundles

Posted by lu...@apache.org.
WW-4587 Adds logic to cache missing bundles


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

Branch: refs/heads/support-2-3
Commit: 15c79e139824143872387a877e2631e8f5d873b8
Parents: dd36946
Author: Lukasz Lenart <lu...@apache.org>
Authored: Tue Jan 26 10:59:47 2016 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Tue Jan 26 10:59:47 2016 +0100

----------------------------------------------------------------------
 .../xwork2/util/LocalizedTextUtil.java          | 30 ++++++++++++--------
 1 file changed, 18 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/15c79e13/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 1e51ded..13a864d 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
@@ -96,6 +96,7 @@ public class LocalizedTextUtil {
     private static boolean devMode;
 
     private static final ConcurrentMap<String, ResourceBundle> bundlesMap = new ConcurrentHashMap<String, ResourceBundle>();
+    private static final Set<String> missingBundles = Collections.synchronizedSet(new HashSet<String>());
     private static final ConcurrentMap<MessageFormatKey, MessageFormat> messageFormats = new ConcurrentHashMap<MessageFormatKey, MessageFormat>();
     private static final ConcurrentMap<Integer, ClassLoader> delegatedClassLoaderMap = new ConcurrentHashMap<Integer, ClassLoader>();
 
@@ -259,32 +260,37 @@ public class LocalizedTextUtil {
      * @return the bundle, <tt>null</tt> if not found.
      */
     public static ResourceBundle findResourceBundle(String aBundleName, Locale locale) {
-
-        ResourceBundle bundle = null;
-
         ClassLoader classLoader = getCurrentThreadContextClassLoader();
         String key = createMissesKey(String.valueOf(classLoader.hashCode()), aBundleName, locale);
+
+        if (missingBundles.contains(key)) {
+            return null;
+        }
+
+        ResourceBundle bundle = null;
         try {
-            if (!bundlesMap.containsKey(key)) {
+            if (bundlesMap.containsKey(key)) {
+                bundle = bundlesMap.get(key);
+            } else {
                 bundle = ResourceBundle.getBundle(aBundleName, locale, classLoader);
                 bundlesMap.putIfAbsent(key, bundle);
-            } else {
-                bundle = bundlesMap.get(key);
             }
         } catch (MissingResourceException ex) {
             if (delegatedClassLoaderMap.containsKey(classLoader.hashCode())) {
                 try {
-                    if (!bundlesMap.containsKey(key)) {
+                    if (bundlesMap.containsKey(key)) {
+                        bundle = bundlesMap.get(key);
+                    } else {
                         bundle = ResourceBundle.getBundle(aBundleName, locale, delegatedClassLoaderMap.get(classLoader.hashCode()));
                         bundlesMap.putIfAbsent(key, bundle);
-                    } else {
-                        bundle = bundlesMap.get(key);
                     }
                 } catch (MissingResourceException e) {
-                    if (LOG.isDebugEnabled()) {
-                        LOG.debug("Missing resource bundle [#0]!", aBundleName);
-                    }
+                    LOG.debug("Missing resource bundle [#0]!", aBundleName);
+                    missingBundles.add(key);
                 }
+            } else {
+                LOG.debug("Missing resource bundle [#0]!", aBundleName);
+                missingBundles.add(key);
             }
         }
         return bundle;