WW-4762 Moves common method up

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

Branch: refs/heads/master
Commit: 7360b5e1956f415866c189d7adda861456d4d069
Parents: bb19a62
Author: Lukasz Lenart <lukaszlen...@apache.org>
Authored: Wed May 10 13:59:20 2017 +0200
Committer: Lukasz Lenart <lukaszlen...@apache.org>
Committed: Wed May 10 13:59:20 2017 +0200

----------------------------------------------------------------------
 .../util/AbstractLocalizedTextProvider.java     | 19 ++++++++++++++++++
 .../util/StrutsLocalizedTextProvider.java       | 21 --------------------
 2 files changed, 19 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/7360b5e1/core/src/main/java/com/opensymphony/xwork2/util/AbstractLocalizedTextProvider.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/com/opensymphony/xwork2/util/AbstractLocalizedTextProvider.java
 
b/core/src/main/java/com/opensymphony/xwork2/util/AbstractLocalizedTextProvider.java
index 8c377c1..1c11fec 100644
--- 
a/core/src/main/java/com/opensymphony/xwork2/util/AbstractLocalizedTextProvider.java
+++ 
b/core/src/main/java/com/opensymphony/xwork2/util/AbstractLocalizedTextProvider.java
@@ -6,6 +6,7 @@ import com.opensymphony.xwork2.inject.Inject;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.message.ParameterizedMessage;
 import org.apache.struts2.StrutsConstants;
 
 import java.lang.reflect.Field;
@@ -20,6 +21,7 @@ import java.util.Map;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 import java.util.Set;
+import java.util.StringTokenizer;
 import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
@@ -77,6 +79,23 @@ abstract class AbstractLocalizedTextProvider implements 
LocalizedTextProvider {
         return Thread.currentThread().getContextClassLoader();
     }
 
+    @Inject(value = StrutsConstants.STRUTS_CUSTOM_I18N_RESOURCES, required = 
false)
+    public void setCustomI18NResources(String bundles) {
+        if (bundles != null && bundles.length() > 0) {
+            StringTokenizer customBundles = new StringTokenizer(bundles, ", ");
+
+            while (customBundles.hasMoreTokens()) {
+                String name = customBundles.nextToken();
+                try {
+                    LOG.trace("Loading global messages from [{}]", name);
+                    addDefaultResourceBundle(name);
+                } catch (Exception e) {
+                    LOG.error(new ParameterizedMessage("Could not find 
messages file {}.properties. Skipping", name), e);
+                }
+            }
+        }
+    }
+
     /**
      * Returns a localized message for the specified key, aTextName.  Neither 
the key nor the
      * message is evaluated.

http://git-wip-us.apache.org/repos/asf/struts/blob/7360b5e1/core/src/main/java/com/opensymphony/xwork2/util/StrutsLocalizedTextProvider.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/com/opensymphony/xwork2/util/StrutsLocalizedTextProvider.java
 
b/core/src/main/java/com/opensymphony/xwork2/util/StrutsLocalizedTextProvider.java
index 9552869..0b97279 100644
--- 
a/core/src/main/java/com/opensymphony/xwork2/util/StrutsLocalizedTextProvider.java
+++ 
b/core/src/main/java/com/opensymphony/xwork2/util/StrutsLocalizedTextProvider.java
@@ -25,19 +25,15 @@ import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.ModelDriven;
 import com.opensymphony.xwork2.conversion.impl.XWorkConverter;
-import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.reflection.ReflectionProviderFactory;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.message.ParameterizedMessage;
-import org.apache.struts2.StrutsConstants;
 
 import java.beans.PropertyDescriptor;
 import java.text.MessageFormat;
 import java.util.Locale;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
-import java.util.StringTokenizer;
 
 /**
  * Provides support for localization in the framework, it can be used to read 
only default bundles,
@@ -62,23 +58,6 @@ public class StrutsLocalizedTextProvider extends 
AbstractLocalizedTextProvider {
         addDefaultResourceBundle(STRUTS_MESSAGES_BUNDLE);
     }
 
-    @Inject(value = StrutsConstants.STRUTS_CUSTOM_I18N_RESOURCES, required = 
false)
-    public void setCustomI18NResources(String bundles) {
-        if (bundles != null && bundles.length() > 0) {
-            StringTokenizer customBundles = new StringTokenizer(bundles, ", ");
-
-            while (customBundles.hasMoreTokens()) {
-                String name = customBundles.nextToken();
-                try {
-                    LOG.trace("Loading global messages from [{}]", name);
-                    addDefaultResourceBundle(name);
-                } catch (Exception e) {
-                    LOG.error(new ParameterizedMessage("Could not find 
messages file {}.properties. Skipping", name), e);
-                }
-            }
-        }
-    }
-
     /**
      * Builds a {@link java.util.Locale} from a String of the form en_US_foo 
into a Locale
      * with language "en", country "US" and variant "foo". This will parse the 
output of

Reply via email to