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 2017/03/14 18:35:54 UTC

[01/24] struts git commit: Converts into a bean

Repository: struts
Updated Branches:
  refs/heads/master 8852e3d11 -> 6ee73dce7


Converts into a bean


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

Branch: refs/heads/master
Commit: b3b8b909e39f403dd76ce349ca546c7dff627e1a
Parents: 6b8272c
Author: Lukasz Lenart <lu...@apache.org>
Authored: Tue Mar 7 11:26:22 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Tue Mar 7 11:26:22 2017 +0100

----------------------------------------------------------------------
 .../xwork2/util/LocalizedTextUtil.java          | 46 +++++++++++---------
 1 file changed, 25 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/b3b8b909/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java b/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
index ad3a713..d69300f 100644
--- a/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
+++ b/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
@@ -25,10 +25,12 @@ 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.commons.lang3.ObjectUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
+import org.apache.struts2.StrutsConstants;
 
 import java.beans.PropertyDescriptor;
 import java.lang.reflect.Field;
@@ -93,8 +95,8 @@ public class LocalizedTextUtil {
 
     private static final ConcurrentMap<Integer, List<String>> classLoaderMap = new ConcurrentHashMap<>();
 
-    private static boolean reloadBundles = false;
-    private static boolean devMode;
+    private boolean reloadBundles = false;
+    private boolean devMode = false;
 
     private static final ConcurrentMap<String, ResourceBundle> bundlesMap = new ConcurrentHashMap<>();
     private static final ConcurrentMap<MessageFormatKey, MessageFormat> messageFormats = new ConcurrentHashMap<>();
@@ -124,12 +126,14 @@ public class LocalizedTextUtil {
      *
      * @param reloadBundles reload bundles?
      */
-    public static void setReloadBundles(boolean reloadBundles) {
-        LocalizedTextUtil.reloadBundles = reloadBundles;
+    @Inject(StrutsConstants.STRUTS_I18N_RELOAD)
+    public void setReloadBundles(String reloadBundles) {
+        this.reloadBundles = Boolean.parseBoolean(reloadBundles);
     }
 
-    public static void setDevMode(boolean devMode) {
-        LocalizedTextUtil.devMode = devMode;
+    @Inject(StrutsConstants.STRUTS_DEVMODE)
+    public void setDevMode(String devMode) {
+        this.devMode = Boolean.parseBoolean(devMode);
     }
 
     /**
@@ -209,7 +213,7 @@ public class LocalizedTextUtil {
      * @param locale    the locale the message should be for
      * @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) {
+    public String findDefaultText(String aTextName, Locale locale) {
         List<String> localList = classLoaderMap.get(Thread.currentThread().getContextClassLoader().hashCode());
 
         for (String bundleName : localList) {
@@ -242,7 +246,7 @@ public class LocalizedTextUtil {
      * @param params    an array of objects to be substituted into the message text
      * @return A formatted 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, Object[] params) {
+    public String findDefaultText(String aTextName, Locale locale, Object[] params) {
         String defaultText = findDefaultText(aTextName, locale);
         if (defaultText != null) {
             MessageFormat mf = buildMessageFormat(defaultText, locale);
@@ -261,7 +265,7 @@ public class LocalizedTextUtil {
      * @param locale      the locale.
      * @return the bundle, <tt>null</tt> if not found.
      */
-    public static ResourceBundle findResourceBundle(String aBundleName, Locale locale) {
+    public ResourceBundle findResourceBundle(String aBundleName, Locale locale) {
         ClassLoader classLoader = getCurrentThreadContextClassLoader();
         String key = createMissesKey(String.valueOf(classLoader.hashCode()), aBundleName, locale);
 
@@ -323,7 +327,7 @@ public class LocalizedTextUtil {
      * @param locale      the locale.
      * @return the key to use for lookup/storing in the bundle misses cache.
      */
-    private static String createMissesKey(String prefix, String aBundleName, Locale locale) {
+    private String createMissesKey(String prefix, String aBundleName, Locale locale) {
         return prefix + aBundleName + "_" + locale.toString();
     }
 
@@ -338,7 +342,7 @@ public class LocalizedTextUtil {
      * @return the localized text, or null if none can be found and no defaultMessage is provided
      * @see #findText(Class aClass, String aTextName, Locale locale, String defaultMessage, Object[] args)
      */
-    public static String findText(Class aClass, String aTextName, Locale locale) {
+    public String findText(Class aClass, String aTextName, Locale locale) {
         return findText(aClass, aTextName, locale, aTextName, new Object[0]);
     }
 
@@ -388,7 +392,7 @@ public class LocalizedTextUtil {
      *                       resource bundle
      * @return the localized text, or null if none can be found and no defaultMessage is provided
      */
-    public static String findText(Class aClass, String aTextName, Locale locale, String defaultMessage, Object[] args) {
+    public String findText(Class aClass, String aTextName, Locale locale, String defaultMessage, Object[] args) {
         ValueStack valueStack = ActionContext.getContext().getValueStack();
         return findText(aClass, aTextName, locale, defaultMessage, args, valueStack);
 
@@ -445,7 +449,7 @@ public class LocalizedTextUtil {
      *                       one in the ActionContext ThreadLocal
      * @return the localized text, or null if none can be found and no defaultMessage is provided
      */
-    public static String findText(Class aClass, String aTextName, Locale locale, String defaultMessage, Object[] args,
+    public String findText(Class aClass, String aTextName, Locale locale, String defaultMessage, Object[] args,
                                   ValueStack valueStack) {
         String indexedTextName = null;
         if (aTextName == null) {
@@ -630,7 +634,7 @@ public class LocalizedTextUtil {
      * @return the localized text, or null if none can be found and no defaultMessage is provided
      * @see #findText(java.util.ResourceBundle, String, java.util.Locale, String, Object[])
      */
-    public static String findText(ResourceBundle bundle, String aTextName, Locale locale) {
+    public String findText(ResourceBundle bundle, String aTextName, Locale locale) {
         return findText(bundle, aTextName, locale, aTextName, new Object[0]);
     }
 
@@ -656,7 +660,7 @@ public class LocalizedTextUtil {
      * @param args           arguments for the message formatter.
      * @return the localized text, or null if none can be found and no defaultMessage is provided
      */
-    public static String findText(ResourceBundle bundle, String aTextName, Locale locale, String defaultMessage, Object[] args) {
+    public String findText(ResourceBundle bundle, String aTextName, Locale locale, String defaultMessage, Object[] args) {
         ValueStack valueStack = ActionContext.getContext().getValueStack();
         return findText(bundle, aTextName, locale, defaultMessage, args, valueStack);
     }
@@ -684,7 +688,7 @@ public class LocalizedTextUtil {
      * @param valueStack     the OGNL value stack.
      * @return the localized text, or null if none can be found and no defaultMessage is provided
      */
-    public static String findText(ResourceBundle bundle, String aTextName, Locale locale, String defaultMessage, Object[] args,
+    public String findText(ResourceBundle bundle, String aTextName, Locale locale, String defaultMessage, Object[] args,
                                   ValueStack valueStack) {
         try {
             reloadBundles(valueStack.getContext());
@@ -711,7 +715,7 @@ public class LocalizedTextUtil {
     /**
      * @return the default message.
      */
-    private static GetDefaultMessageReturnArg getDefaultMessage(String key, Locale locale, ValueStack valueStack, Object[] args,
+    private GetDefaultMessageReturnArg getDefaultMessage(String key, Locale locale, ValueStack valueStack, Object[] args,
                                                                 String defaultMessage) {
         GetDefaultMessageReturnArg result = null;
         boolean found = true;
@@ -739,7 +743,7 @@ public class LocalizedTextUtil {
     /**
      * @return the message from the named resource bundle.
      */
-    private static String getMessage(String bundleName, Locale locale, String key, ValueStack valueStack, Object[] args) {
+    private String getMessage(String bundleName, Locale locale, String key, ValueStack valueStack, Object[] args) {
         ResourceBundle bundle = findResourceBundle(bundleName, locale);
         if (bundle == null) {
             return null;
@@ -790,7 +794,7 @@ public class LocalizedTextUtil {
      *
      * @return the message
      */
-    private static String findMessage(Class clazz, String key, String indexedKey, Locale locale, Object[] args, Set<String> checked,
+    private String findMessage(Class clazz, String key, String indexedKey, Locale locale, Object[] args, Set<String> checked,
                                       ValueStack valueStack) {
         if (checked == null) {
             checked = new TreeSet<String>();
@@ -852,11 +856,11 @@ public class LocalizedTextUtil {
         return null;
     }
 
-    private static void reloadBundles() {
+    private void reloadBundles() {
         reloadBundles(ActionContext.getContext() != null ? ActionContext.getContext().getContextMap() : null);
     }
 
-    private static void reloadBundles(Map<String, Object> context) {
+    private void reloadBundles(Map<String, Object> context) {
         if (reloadBundles) {
             try {
                 Boolean reloaded;


[11/24] struts git commit: Marks deprecated constructor

Posted by lu...@apache.org.
Marks deprecated constructor


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

Branch: refs/heads/master
Commit: 1ab616b10b2c43052bd8806e6e08fc0772de8b8a
Parents: 442a52f
Author: Lukasz Lenart <lu...@apache.org>
Authored: Thu Mar 9 09:44:07 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Thu Mar 9 09:44:07 2017 +0100

----------------------------------------------------------------------
 .../opensymphony/xwork2/validator/GenericValidatorContext.java  | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/1ab616b1/core/src/test/java/com/opensymphony/xwork2/validator/GenericValidatorContext.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/validator/GenericValidatorContext.java b/core/src/test/java/com/opensymphony/xwork2/validator/GenericValidatorContext.java
index 6273259..0c7e067 100644
--- a/core/src/test/java/com/opensymphony/xwork2/validator/GenericValidatorContext.java
+++ b/core/src/test/java/com/opensymphony/xwork2/validator/GenericValidatorContext.java
@@ -31,11 +31,14 @@ public class GenericValidatorContext extends DelegatingValidatorContext {
     private Map<String, List<String>> fieldErrors;
 
 
+    /**
+     * @deprecated Is used only in tests and will be removed
+     */
+    @Deprecated
     public GenericValidatorContext(Object object) {
         super(object);
     }
 
-
     @Override
     public synchronized void setActionErrors(Collection<String> errorMessages) {
         this.actionErrors = errorMessages;


[03/24] struts git commit: Adds LocalizedTextUtil as a bean

Posted by lu...@apache.org.
Adds LocalizedTextUtil as a bean


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

Branch: refs/heads/master
Commit: fa1a5f9e6927ab7521c30366631e128371d41277
Parents: ae09c6a
Author: Lukasz Lenart <lu...@apache.org>
Authored: Wed Mar 8 17:42:13 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Wed Mar 8 17:42:13 2017 +0100

----------------------------------------------------------------------
 .../opensymphony/xwork2/config/impl/DefaultConfiguration.java    | 4 ++++
 .../xwork2/config/providers/XWorkConfigurationProvider.java      | 4 ++++
 2 files changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/fa1a5f9e/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java b/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
index 08977b2..31bf283 100644
--- a/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
+++ b/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
@@ -246,6 +246,8 @@ public class DefaultConfiguration implements Configuration {
         builder.factory(ReflectionProvider.class, OgnlReflectionProvider.class, Scope.SINGLETON);
         builder.factory(ValueStackFactory.class, OgnlValueStackFactory.class, Scope.SINGLETON);
 
+        builder.factory(LocalizedTextUtil.class, LocalizedTextUtil.class, Scope.SINGLETON);
+
         builder.factory(XWorkConverter.class, Scope.SINGLETON);
         builder.factory(ConversionPropertiesProcessor.class, DefaultConversionPropertiesProcessor.class, Scope.SINGLETON);
         builder.factory(ConversionFileProcessor.class, DefaultConversionFileProcessor.class, Scope.SINGLETON);
@@ -270,10 +272,12 @@ public class DefaultConfiguration implements Configuration {
         builder.factory(ValueSubstitutor.class, EnvsValueSubstitutor.class, Scope.SINGLETON);
 
         builder.constant(XWorkConstants.DEV_MODE, "false");
+        builder.constant(StrutsConstants.STRUTS_DEVMODE, "false");
         builder.constant(XWorkConstants.LOG_MISSING_PROPERTIES, "false");
         builder.constant(XWorkConstants.ENABLE_OGNL_EVAL_EXPRESSION, "false");
         builder.constant(XWorkConstants.ENABLE_OGNL_EXPRESSION_CACHE, "true");
         builder.constant(XWorkConstants.RELOAD_XML_CONFIGURATION, "false");
+        builder.constant(StrutsConstants.STRUTS_I18N_RELOAD, "false");
 
         return builder.create(true);
     }

http://git-wip-us.apache.org/repos/asf/struts/blob/fa1a5f9e/core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java b/core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java
index fc335d8..de0b963 100644
--- a/core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java
+++ b/core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java
@@ -70,6 +70,7 @@ import com.opensymphony.xwork2.ognl.accessor.XWorkListPropertyAccessor;
 import com.opensymphony.xwork2.ognl.accessor.XWorkMapPropertyAccessor;
 import com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor;
 import com.opensymphony.xwork2.util.CompoundRoot;
+import com.opensymphony.xwork2.util.LocalizedTextUtil;
 import com.opensymphony.xwork2.util.OgnlTextParser;
 import com.opensymphony.xwork2.util.PatternMatcher;
 import com.opensymphony.xwork2.util.TextParser;
@@ -177,6 +178,7 @@ public class XWorkConfigurationProvider implements ConfigurationProvider {
                 .factory(NullHandler.class, Object.class.getName(), InstantiatingNullHandler.class, Scope.SINGLETON)
                 .factory(ActionValidatorManager.class, AnnotationActionValidatorManager.class, Scope.SINGLETON)
                 .factory(ActionValidatorManager.class, "no-annotations", DefaultActionValidatorManager.class, Scope.SINGLETON)
+                .factory(LocalizedTextUtil.class, LocalizedTextUtil.class, Scope.SINGLETON)
                 .factory(TextProvider.class, "system", DefaultTextProvider.class, Scope.SINGLETON)
                 .factory(TextProvider.class, TextProviderSupport.class, Scope.SINGLETON)
                 .factory(LocaleProvider.class, DefaultLocaleProvider.class, Scope.SINGLETON)
@@ -194,6 +196,8 @@ public class XWorkConfigurationProvider implements ConfigurationProvider {
         ;
 
         props.setProperty(StrutsConstants.STRUTS_ENABLE_DYNAMIC_METHOD_INVOCATION, Boolean.FALSE.toString());
+        props.setProperty(StrutsConstants.STRUTS_I18N_RELOAD, Boolean.FALSE.toString());
+        props.setProperty(StrutsConstants.STRUTS_DEVMODE, Boolean.FALSE.toString());
         props.setProperty(XWorkConstants.DEV_MODE, Boolean.FALSE.toString());
         props.setProperty(XWorkConstants.LOG_MISSING_PROPERTIES, Boolean.FALSE.toString());
         props.setProperty(XWorkConstants.ENABLE_OGNL_EXPRESSION_CACHE, Boolean.TRUE.toString());


[19/24] struts git commit: Adds missing header

Posted by lu...@apache.org.
Adds missing header


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

Branch: refs/heads/master
Commit: c3416e8ea00c0dbf5023eadd6c066c04bdbd472c
Parents: 6e89179
Author: Lukasz Lenart <lu...@apache.org>
Authored: Tue Mar 14 09:49:54 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Tue Mar 14 09:49:54 2017 +0100

----------------------------------------------------------------------
 .../xwork2/LocalizedTextProvider.java            | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/c3416e8e/core/src/main/java/com/opensymphony/xwork2/LocalizedTextProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/LocalizedTextProvider.java b/core/src/main/java/com/opensymphony/xwork2/LocalizedTextProvider.java
index f6175ea..ecd037d 100644
--- a/core/src/main/java/com/opensymphony/xwork2/LocalizedTextProvider.java
+++ b/core/src/main/java/com/opensymphony/xwork2/LocalizedTextProvider.java
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 package com.opensymphony.xwork2;
 
 import com.opensymphony.xwork2.util.ValueStack;


[07/24] struts git commit: Moves default bean name to common place

Posted by lu...@apache.org.
Moves default bean name to common place


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

Branch: refs/heads/master
Commit: 524343c3cf79faad15e49fc26221de308853cbfc
Parents: 2733f15
Author: Lukasz Lenart <lu...@apache.org>
Authored: Wed Mar 8 17:45:32 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Wed Mar 8 17:45:32 2017 +0100

----------------------------------------------------------------------
 .../opensymphony/xwork2/config/impl/DefaultConfiguration.java | 4 +++-
 .../apache/struts2/config/AbstractBeanSelectionProvider.java  | 7 +++----
 .../main/java/org/apache/struts2/dispatcher/Dispatcher.java   | 3 ++-
 3 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/524343c3/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java b/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
index 31bf283..9830d92 100644
--- a/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
+++ b/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
@@ -51,6 +51,8 @@ import java.util.*;
  */
 public class DefaultConfiguration implements Configuration {
 
+    public static final String DEFAULT_BEAN_NAME = "struts";
+
     protected static final Logger LOG = LogManager.getLogger(DefaultConfiguration.class);
 
 
@@ -66,7 +68,7 @@ public class DefaultConfiguration implements Configuration {
     ObjectFactory objectFactory;
 
     public DefaultConfiguration() {
-        this("xwork");
+        this(DEFAULT_BEAN_NAME);
     }
 
     public DefaultConfiguration(String defaultBeanName) {

http://git-wip-us.apache.org/repos/asf/struts/blob/524343c3/core/src/main/java/org/apache/struts2/config/AbstractBeanSelectionProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/config/AbstractBeanSelectionProvider.java b/core/src/main/java/org/apache/struts2/config/AbstractBeanSelectionProvider.java
index 34e340b..f0c691f 100644
--- a/core/src/main/java/org/apache/struts2/config/AbstractBeanSelectionProvider.java
+++ b/core/src/main/java/org/apache/struts2/config/AbstractBeanSelectionProvider.java
@@ -4,6 +4,7 @@ import com.opensymphony.xwork2.ObjectFactory;
 import com.opensymphony.xwork2.config.BeanSelectionProvider;
 import com.opensymphony.xwork2.config.Configuration;
 import com.opensymphony.xwork2.config.ConfigurationException;
+import com.opensymphony.xwork2.config.impl.DefaultConfiguration;
 import com.opensymphony.xwork2.inject.*;
 import com.opensymphony.xwork2.util.ClassLoaderUtil;
 import com.opensymphony.xwork2.util.location.LocatableProperties;
@@ -19,8 +20,6 @@ public abstract class AbstractBeanSelectionProvider implements BeanSelectionProv
 
     private static final Logger LOG = LogManager.getLogger(AbstractBeanSelectionProvider.class);
 
-    public static final String DEFAULT_BEAN_NAME = "struts";
-
     public void destroy() {
         // NO-OP
     }
@@ -43,7 +42,7 @@ public abstract class AbstractBeanSelectionProvider implements BeanSelectionProv
 
     protected void alias(Class type, String key, ContainerBuilder builder, Properties props, Scope scope) {
         if (!builder.contains(type)) {
-            String foundName = props.getProperty(key, DEFAULT_BEAN_NAME);
+            String foundName = props.getProperty(key, DefaultConfiguration.DEFAULT_BEAN_NAME);
             if (builder.contains(type, foundName)) {
                 LOG.trace("Choosing bean ({}) for ({})", foundName, type.getName());
                 builder.alias(type, foundName, Container.DEFAULT_NAME);
@@ -55,7 +54,7 @@ public abstract class AbstractBeanSelectionProvider implements BeanSelectionProv
                 } catch (ClassNotFoundException ex) {
                     // Perhaps a spring bean id, so we'll delegate to the object factory at runtime
                     LOG.trace("Choosing bean ({}) for ({}) to be loaded from the ObjectFactory", foundName, type.getName());
-                    if (DEFAULT_BEAN_NAME.equals(foundName)) {
+                    if (DefaultConfiguration.DEFAULT_BEAN_NAME.equals(foundName)) {
                         // Probably an optional bean, will ignore
                     } else {
                         if (ObjectFactory.class != type) {

http://git-wip-us.apache.org/repos/asf/struts/blob/524343c3/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
index 226ecfc..d0431f4 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
@@ -26,6 +26,7 @@ import com.opensymphony.xwork2.config.*;
 import com.opensymphony.xwork2.config.entities.InterceptorMapping;
 import com.opensymphony.xwork2.config.entities.InterceptorStackConfig;
 import com.opensymphony.xwork2.config.entities.PackageConfig;
+import com.opensymphony.xwork2.config.impl.DefaultConfiguration;
 import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
 import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.inject.ContainerBuilder;
@@ -463,7 +464,7 @@ public class Dispatcher {
     public void init() {
 
     	if (configurationManager == null) {
-    		configurationManager = createConfigurationManager(DefaultBeanSelectionProvider.DEFAULT_BEAN_NAME);
+    		configurationManager = createConfigurationManager(DefaultConfiguration.DEFAULT_BEAN_NAME);
     	}
 
         try {


[05/24] struts git commit: Injects instead of static reference

Posted by lu...@apache.org.
Injects instead of static reference


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

Branch: refs/heads/master
Commit: 4ef641850539557ffbc9412ff1d6627a8e08fd32
Parents: 239327e
Author: Lukasz Lenart <lu...@apache.org>
Authored: Wed Mar 8 17:43:20 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Wed Mar 8 17:43:20 2017 +0100

----------------------------------------------------------------------
 .../opensymphony/xwork2/DefaultActionProxy.java | 13 +++++++---
 .../xwork2/DefaultTextProvider.java             | 16 +++++++++---
 .../xwork2/TextProviderSupport.java             | 27 ++++++++++++--------
 .../xwork2/conversion/impl/XWorkConverter.java  |  3 ++-
 .../xwork2/interceptor/AliasInterceptor.java    | 14 +++++++---
 .../interceptor/ParametersInterceptor.java      | 19 +++++++++-----
 .../StaticParametersInterceptor.java            | 11 ++++++--
 .../org/apache/struts2/components/Date.java     | 22 ++++++++--------
 .../org/apache/struts2/components/I18n.java     |  2 +-
 .../apache/struts2/dispatcher/Dispatcher.java   | 10 +-------
 .../multipart/JakartaMultiPartRequest.java      |  6 +----
 .../struts2/factory/StrutsActionProxy.java      |  2 +-
 .../org/apache/struts2/util/TokenHelper.java    |  3 ++-
 .../multipart/PellMultiPartRequest.java         |  6 +----
 14 files changed, 90 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/4ef64185/core/src/main/java/com/opensymphony/xwork2/DefaultActionProxy.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/DefaultActionProxy.java b/core/src/main/java/com/opensymphony/xwork2/DefaultActionProxy.java
index 2d8bc38..39a484d 100644
--- a/core/src/main/java/com/opensymphony/xwork2/DefaultActionProxy.java
+++ b/core/src/main/java/com/opensymphony/xwork2/DefaultActionProxy.java
@@ -53,6 +53,8 @@ public class DefaultActionProxy implements ActionProxy, Serializable {
     protected ActionConfig config;
     protected ActionInvocation invocation;
     protected UnknownHandlerManager unknownHandlerManager;
+    protected LocalizedTextUtil localizedTextUtil;
+
     protected String actionName;
     protected String namespace;
     protected String method;
@@ -113,6 +115,11 @@ public class DefaultActionProxy implements ActionProxy, Serializable {
         this.actionEventListener = listener;
     }
 
+    @Inject
+    public void setLocalizedTextUtil(LocalizedTextUtil localizedTextUtil) {
+        this.localizedTextUtil = localizedTextUtil;
+    }
+
     public Object getAction() {
         return invocation.getAction();
     }
@@ -205,7 +212,7 @@ public class DefaultActionProxy implements ActionProxy, Serializable {
     }
 
     protected String prepareNotAllowedErrorMessage() {
-        return LocalizedTextUtil.findDefaultText(
+        return localizedTextUtil.findDefaultText(
                 "struts.exception.method-not-allowed",
                 Locale.getDefault(),
                 new String[]{method, actionName}
@@ -214,12 +221,12 @@ public class DefaultActionProxy implements ActionProxy, Serializable {
 
     protected String getErrorMessage() {
         if ((namespace != null) && (namespace.trim().length() > 0)) {
-            return LocalizedTextUtil.findDefaultText(
+            return localizedTextUtil.findDefaultText(
                     "xwork.exception.missing-package-action",
                     Locale.getDefault(),
                     new String[]{namespace, actionName});
         } else {
-            return LocalizedTextUtil.findDefaultText(
+            return localizedTextUtil.findDefaultText(
                     "xwork.exception.missing-action",
                     Locale.getDefault(),
                     new String[]{actionName});

http://git-wip-us.apache.org/repos/asf/struts/blob/4ef64185/core/src/main/java/com/opensymphony/xwork2/DefaultTextProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/DefaultTextProvider.java b/core/src/main/java/com/opensymphony/xwork2/DefaultTextProvider.java
index 1d72161..0e3f5b1 100644
--- a/core/src/main/java/com/opensymphony/xwork2/DefaultTextProvider.java
+++ b/core/src/main/java/com/opensymphony/xwork2/DefaultTextProvider.java
@@ -15,6 +15,7 @@
  */
 package com.opensymphony.xwork2;
 
+import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.LocalizedTextUtil;
 import com.opensymphony.xwork2.util.ValueStack;
 
@@ -37,15 +38,22 @@ public class DefaultTextProvider implements TextProvider, Serializable, Unchaina
 
     private static final Object[] EMPTY_ARGS = new Object[0];
 
+    protected LocalizedTextUtil localizedTextUtil;
+
     public DefaultTextProvider() {
     }
 
+    @Inject
+    public void setLocalizedTextUtil(LocalizedTextUtil localizedTextUtil) {
+        this.localizedTextUtil = localizedTextUtil;
+    }
+
     public boolean hasKey(String key) {
         return getText(key) != null;
     }
 
     public String getText(String key) {
-        return LocalizedTextUtil.findDefaultText(key, ActionContext.getContext().getLocale());
+        return localizedTextUtil.findDefaultText(key, ActionContext.getContext().getLocale());
     }
 
     public String getText(String key, String defaultValue) {
@@ -64,7 +72,7 @@ public class DefaultTextProvider implements TextProvider, Serializable, Unchaina
             params = EMPTY_ARGS;
         }
 
-        return LocalizedTextUtil.findDefaultText(key, ActionContext.getContext().getLocale(), params);
+        return localizedTextUtil.findDefaultText(key, ActionContext.getContext().getLocale(), params);
     }
 
     public String getText(String key, String[] args) {
@@ -75,7 +83,7 @@ public class DefaultTextProvider implements TextProvider, Serializable, Unchaina
             params = EMPTY_ARGS;
         }
 
-        return LocalizedTextUtil.findDefaultText(key, ActionContext.getContext().getLocale(), params);
+        return localizedTextUtil.findDefaultText(key, ActionContext.getContext().getLocale(), params);
     }
 
     public String getText(String key, String defaultValue, List<?> args) {
@@ -136,7 +144,7 @@ public class DefaultTextProvider implements TextProvider, Serializable, Unchaina
     }
 
     public ResourceBundle getTexts(String bundleName) {
-        return LocalizedTextUtil.findResourceBundle(bundleName, ActionContext.getContext().getLocale());
+        return localizedTextUtil.findResourceBundle(bundleName, ActionContext.getContext().getLocale());
     }
 
     public ResourceBundle getTexts() {

http://git-wip-us.apache.org/repos/asf/struts/blob/4ef64185/core/src/main/java/com/opensymphony/xwork2/TextProviderSupport.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/TextProviderSupport.java b/core/src/main/java/com/opensymphony/xwork2/TextProviderSupport.java
index 3f20902..ab37e92 100644
--- a/core/src/main/java/com/opensymphony/xwork2/TextProviderSupport.java
+++ b/core/src/main/java/com/opensymphony/xwork2/TextProviderSupport.java
@@ -33,6 +33,7 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
     private Class clazz;
     private LocaleProvider localeProvider;
     private ResourceBundle bundle;
+    private LocalizedTextUtil localizedTextUtil;
 
     /**
      * Default constructor
@@ -85,6 +86,10 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
         this.localeProvider = localeProvider;
     }
 
+    @Inject
+    public void setLocalizedTextUtil(LocalizedTextUtil localizedTextUtil) {
+        this.localizedTextUtil = localizedTextUtil;
+    }
 
     /**
      * Checks if a key is available in the resource bundles associated with this action.
@@ -97,9 +102,9 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
     public boolean hasKey(String key) {
     	String message;
     	if (clazz != null) {
-            message =  LocalizedTextUtil.findText(clazz, key, getLocale(), null, new Object[0] );
+            message = localizedTextUtil.findText(clazz, key, getLocale(), null, new Object[0] );
         } else {
-            message = LocalizedTextUtil.findText(bundle, key, getLocale(), null, new Object[0]);
+            message = localizedTextUtil.findText(bundle, key, getLocale(), null, new Object[0]);
         }
     	return message != null;
     }
@@ -201,9 +206,9 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
     public String getText(String key, String defaultValue, List<?> args) {
         Object[] argsArray = ((args != null && !args.equals(Collections.emptyList())) ? args.toArray() : null);
         if (clazz != null) {
-            return LocalizedTextUtil.findText(clazz, key, getLocale(), defaultValue, argsArray);
+            return localizedTextUtil.findText(clazz, key, getLocale(), defaultValue, argsArray);
         } else {
-            return LocalizedTextUtil.findText(bundle, key, getLocale(), defaultValue, argsArray);
+            return localizedTextUtil.findText(bundle, key, getLocale(), defaultValue, argsArray);
         }
     }
 
@@ -222,9 +227,9 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
      */
     public String getText(String key, String defaultValue, String[] args) {
         if (clazz != null) {
-            return LocalizedTextUtil.findText(clazz, key, getLocale(), defaultValue, args);
+            return localizedTextUtil.findText(clazz, key, getLocale(), defaultValue, args);
         } else {
-            return LocalizedTextUtil.findText(bundle, key, getLocale(), defaultValue, args);
+            return localizedTextUtil.findText(bundle, key, getLocale(), defaultValue, args);
         }
     }
 
@@ -252,9 +257,9 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
             locale = getLocale();
         }
         if (clazz != null) {
-            return LocalizedTextUtil.findText(clazz, key, locale, defaultValue, argsArray, stack);
+            return localizedTextUtil.findText(clazz, key, locale, defaultValue, argsArray, stack);
         } else {
-            return LocalizedTextUtil.findText(bundle, key, locale, defaultValue, argsArray, stack);
+            return localizedTextUtil.findText(bundle, key, locale, defaultValue, argsArray, stack);
         }
     }
 
@@ -282,9 +287,9 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
             locale = getLocale();
         }
         if (clazz != null) {
-            return LocalizedTextUtil.findText(clazz, key, locale, defaultValue, args, stack);
+            return localizedTextUtil.findText(clazz, key, locale, defaultValue, args, stack);
         } else {
-            return LocalizedTextUtil.findText(bundle, key, locale, defaultValue, args, stack);
+            return localizedTextUtil.findText(bundle, key, locale, defaultValue, args, stack);
         }
 
     }
@@ -304,7 +309,7 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
      * @return a resource bundle
      */
     public ResourceBundle getTexts(String aBundleName) {
-        return LocalizedTextUtil.findResourceBundle(aBundleName, getLocale());
+        return localizedTextUtil.findResourceBundle(aBundleName, getLocale());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/struts/blob/4ef64185/core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java b/core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java
index 9dfcd4d..771fc36 100644
--- a/core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java
+++ b/core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java
@@ -194,7 +194,8 @@ public class XWorkConverter extends DefaultTypeConverter {
     }
 
     public static String getConversionErrorMessage(String propertyName, ValueStack stack) {
-        String defaultMessage = LocalizedTextUtil.findDefaultText("xwork.default.invalid.fieldvalue",
+        LocalizedTextUtil localizedTextUtil = ActionContext.getContext().getContainer().getInstance(LocalizedTextUtil.class);
+        String defaultMessage = localizedTextUtil.findDefaultText("xwork.default.invalid.fieldvalue",
                 ActionContext.getContext().getLocale(),
                 new Object[]{
                         propertyName

http://git-wip-us.apache.org/repos/asf/struts/blob/4ef64185/core/src/main/java/com/opensymphony/xwork2/interceptor/AliasInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/AliasInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/AliasInterceptor.java
index a956aea..9d260c1 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/AliasInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/AliasInterceptor.java
@@ -94,11 +94,12 @@ public class AliasInterceptor extends AbstractInterceptor {
     protected String aliasesKey = DEFAULT_ALIAS_KEY;
 
     protected ValueStackFactory valueStackFactory;
-    static boolean devMode = false;
+    protected LocalizedTextUtil localizedTextUtil;
+    protected boolean devMode = false;
 
     @Inject(XWorkConstants.DEV_MODE)
-    public static void setDevMode(String mode) {
-        devMode = "true".equals(mode);
+    public void setDevMode(String mode) {
+        this.devMode = Boolean.parseBoolean(mode);
     }   
 
     @Inject
@@ -106,6 +107,11 @@ public class AliasInterceptor extends AbstractInterceptor {
         this.valueStackFactory = valueStackFactory;
     }
 
+    @Inject
+    public void setLocalizedTextUtil(LocalizedTextUtil localizedTextUtil) {
+        this.localizedTextUtil = localizedTextUtil;
+    }
+
     /**
      * <p>
      * Sets the name of the action parameter to look for the alias map.
@@ -173,7 +179,7 @@ public class AliasInterceptor extends AbstractInterceptor {
                             newStack.setValue(alias, value.get());
                         } catch (RuntimeException e) {
                             if (devMode) {
-                                String developerNotification = LocalizedTextUtil.findText(ParametersInterceptor.class, "devmode.notification", ActionContext.getContext().getLocale(), "Developer Notification:\n{0}", new Object[]{
+                                String developerNotification = localizedTextUtil.findText(ParametersInterceptor.class, "devmode.notification", ActionContext.getContext().getLocale(), "Developer Notification:\n{0}", new Object[]{
                                         "Unexpected Exception caught setting '" + entry.getKey() + "' on '" + action.getClass() + ": " + e.getMessage()
                                 });
                                 LOG.error(developerNotification);

http://git-wip-us.apache.org/repos/asf/struts/blob/4ef64185/core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
index c1c52d9..5eba95d 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
@@ -17,6 +17,7 @@ package com.opensymphony.xwork2.interceptor;
 
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.TextProvider;
 import com.opensymphony.xwork2.XWorkConstants;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.security.AcceptedPatternsChecker;
@@ -218,15 +219,19 @@ public class ParametersInterceptor extends MethodFilterInterceptor {
     }
 
     protected void notifyDeveloperParameterException(Object action, String property, String message) {
-        String developerNotification = LocalizedTextUtil.findText(ParametersInterceptor.class, "devmode.notification",
-                ActionContext.getContext().getLocale(), "Developer Notification:\n{0}",
-                new Object[]{
-                        "Unexpected Exception caught setting '" + property + "' on '" + action.getClass() + ": " + message
-                }
-        );
+        String developerNotification = "Unexpected Exception caught setting '" + property + "' on '" + action.getClass() + ": " + message;
+        if (action instanceof TextProvider) {
+            TextProvider tp = (TextProvider) action;
+            developerNotification = tp.getText("devmode.notification",
+                    "Developer Notification:\n{0}",
+                    new String[]{ developerNotification }
+            );
+        }
+
         LOG.error(developerNotification);
-        // see https://issues.apache.org/jira/browse/WW-4066
+
         if (action instanceof ValidationAware) {
+            // see https://issues.apache.org/jira/browse/WW-4066
             Collection<String> messages = ((ValidationAware) action).getActionMessages();
             messages.add(message);
             ((ValidationAware) action).setActionMessages(messages);

http://git-wip-us.apache.org/repos/asf/struts/blob/4ef64185/core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java
index 8aab382..b697a64 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java
@@ -93,6 +93,7 @@ public class StaticParametersInterceptor extends AbstractInterceptor {
     private static final Logger LOG = LogManager.getLogger(StaticParametersInterceptor.class);
 
     private ValueStackFactory valueStackFactory;
+    private LocalizedTextUtil localizedTextUtil;
 
     @Inject
     public void setValueStackFactory(ValueStackFactory valueStackFactory) {
@@ -102,7 +103,12 @@ public class StaticParametersInterceptor extends AbstractInterceptor {
     @Inject(XWorkConstants.DEV_MODE)
     public void setDevMode(String mode) {
         devMode = BooleanUtils.toBoolean(mode);
-    }    
+    }
+
+    @Inject
+    public void setLocalizedTextUtil(LocalizedTextUtil localizedTextUtil) {
+        this.localizedTextUtil = localizedTextUtil;
+    }
 
     public void setParse(String value) {
         this.parse = BooleanUtils.toBoolean(value);
@@ -168,7 +174,8 @@ public class StaticParametersInterceptor extends AbstractInterceptor {
                         newStack.setValue(entry.getKey(), val);
                     } catch (RuntimeException e) {
                         if (devMode) {
-                            String developerNotification = LocalizedTextUtil.findText(ParametersInterceptor.class, "devmode.notification", ActionContext.getContext().getLocale(), "Developer Notification:\n{0}", new Object[]{
+
+                            String developerNotification = localizedTextUtil.findText(ParametersInterceptor.class, "devmode.notification", ActionContext.getContext().getLocale(), "Developer Notification:\n{0}", new Object[]{
                                     "Unexpected Exception caught setting '" + entry.getKey() + "' on '" + action.getClass() + ": " + e.getMessage()
                             });
                             LOG.error(developerNotification);

http://git-wip-us.apache.org/repos/asf/struts/blob/4ef64185/core/src/main/java/org/apache/struts2/components/Date.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/Date.java b/core/src/main/java/org/apache/struts2/components/Date.java
index ac3d68b..46c193d 100644
--- a/core/src/main/java/org/apache/struts2/components/Date.java
+++ b/core/src/main/java/org/apache/struts2/components/Date.java
@@ -294,16 +294,18 @@ public class Date extends ContextBean {
                 date = new java.util.Date((long) dateObject);
             } else {
                 if (devMode) {
-                    String developerNotification = LocalizedTextUtil.findText(
-                            Date.class,
-                            "devmode.notification",
-                            ActionContext.getContext().getLocale(),
-                            "Developer Notification:\n{0}",
-                            new Object[]{
-                                    "Expression [" + name + "] passed to <s:date/> tag which was evaluated to [" + dateObject + "]("
-                                            + (dateObject != null ? dateObject.getClass() : "null") + ") isn't instance of java.util.Date nor java.util.Calendar nor long!"
-                            }
-                    );
+                    TextProvider tp = findProviderInStack();
+                    String developerNotification = "";
+                    if (tp != null) {
+                        developerNotification = findProviderInStack().getText(
+                                "devmode.notification",
+                                "Developer Notification:\n{0}",
+                                new String[]{
+                                        "Expression [" + name + "] passed to <s:date/> tag which was evaluated to [" + dateObject + "]("
+                                                + (dateObject != null ? dateObject.getClass() : "null") + ") isn't instance of java.util.Date nor java.util.Calendar nor long!"
+                                }
+                        );
+                    }
                     LOG.warn(developerNotification);
                 } else {
                     LOG.debug("Expression [{}] passed to <s:date/> tag which was evaluated to [{}]({}) isn't instance of java.util.Date nor java.util.Calendar nor long!",

http://git-wip-us.apache.org/repos/asf/struts/blob/4ef64185/core/src/main/java/org/apache/struts2/components/I18n.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/I18n.java b/core/src/main/java/org/apache/struts2/components/I18n.java
index a04840f..7a538b1 100644
--- a/core/src/main/java/org/apache/struts2/components/I18n.java
+++ b/core/src/main/java/org/apache/struts2/components/I18n.java
@@ -121,7 +121,7 @@ public class I18n extends Component {
             ResourceBundle bundle = defaultTextProvider.getTexts(name);
 
             if (bundle == null) {
-                bundle = LocalizedTextUtil.findResourceBundle(name, localeProvider.getLocale());
+                bundle = container.getInstance(LocalizedTextUtil.class).findResourceBundle(name, localeProvider.getLocale());
             }
 
             if (bundle != null) {

http://git-wip-us.apache.org/repos/asf/struts/blob/4ef64185/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
index 909e802..226ecfc 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
@@ -442,15 +442,7 @@ public class Dispatcher {
     }
 
     private Container init_PreloadConfiguration() {
-        Container container = getContainer();
-
-        boolean reloadi18n = Boolean.valueOf(container.getInstance(String.class, StrutsConstants.STRUTS_I18N_RELOAD));
-        LocalizedTextUtil.setReloadBundles(reloadi18n);
-
-        boolean devMode = Boolean.valueOf(container.getInstance(String.class, StrutsConstants.STRUTS_DEVMODE));
-        LocalizedTextUtil.setDevMode(devMode);
-
-        return container;
+        return getContainer();
     }
 
     private void init_CheckWebLogicWorkaround(Container container) {

http://git-wip-us.apache.org/repos/asf/struts/blob/4ef64185/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java b/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
index 02de7f2..f12f1b5 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
@@ -337,11 +337,7 @@ public class JakartaMultiPartRequest extends AbstractMultiPartRequest {
         for (String name : names) {
             List<FileItem> items = files.get(name);
             for (FileItem item : items) {
-                if (LOG.isDebugEnabled()) {
-                    String msg = LocalizedTextUtil.findText(this.getClass(), "struts.messages.removing.file",
-                            Locale.ENGLISH, "no.message.found", new Object[]{name, item});
-                    LOG.debug(msg);
-                }
+                LOG.debug("Removing file {} {}", name, item );
                 if (!item.isInMemory()) {
                     item.delete();
                 }

http://git-wip-us.apache.org/repos/asf/struts/blob/4ef64185/core/src/main/java/org/apache/struts2/factory/StrutsActionProxy.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/factory/StrutsActionProxy.java b/core/src/main/java/org/apache/struts2/factory/StrutsActionProxy.java
index 52f2efb..64323c3 100644
--- a/core/src/main/java/org/apache/struts2/factory/StrutsActionProxy.java
+++ b/core/src/main/java/org/apache/struts2/factory/StrutsActionProxy.java
@@ -67,7 +67,7 @@ public class StrutsActionProxy extends DefaultActionProxy {
     protected String getErrorMessage() {
         if ((namespace != null) && (namespace.trim().length() > 0)) {
             String contextPath = ServletActionContext.getRequest().getContextPath();
-            return LocalizedTextUtil.findDefaultText(
+            return localizedTextUtil.findDefaultText(
                     "struts.exception.missing-package-action.with-context",
                     Locale.getDefault(),
                     new String[]{namespace, actionName, contextPath}

http://git-wip-us.apache.org/repos/asf/struts/blob/4ef64185/core/src/main/java/org/apache/struts2/util/TokenHelper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/util/TokenHelper.java b/core/src/main/java/org/apache/struts2/util/TokenHelper.java
index d4ae8aa..c6d0f0f 100644
--- a/core/src/main/java/org/apache/struts2/util/TokenHelper.java
+++ b/core/src/main/java/org/apache/struts2/util/TokenHelper.java
@@ -188,7 +188,8 @@ public class TokenHelper {
 
         if (!token.equals(sessionToken)) {
             if (LOG.isWarnEnabled()) {
-                LOG.warn(LocalizedTextUtil.findText(TokenHelper.class, "struts.internal.invalid.token", ActionContext.getContext().getLocale(), "Form token {0} does not match the session token {1}.", new Object[]{
+                LocalizedTextUtil localizedTextUtil = ActionContext.getContext().getContainer().getInstance(LocalizedTextUtil.class);
+                LOG.warn(localizedTextUtil.findText(TokenHelper.class, "struts.internal.invalid.token", ActionContext.getContext().getLocale(), "Form token {0} does not match the session token {1}.", new Object[]{
                         token, sessionToken
                 }));
             }

http://git-wip-us.apache.org/repos/asf/struts/blob/4ef64185/plugins/pell-multipart/src/main/java/org/apache/struts2/dispatcher/multipart/PellMultiPartRequest.java
----------------------------------------------------------------------
diff --git a/plugins/pell-multipart/src/main/java/org/apache/struts2/dispatcher/multipart/PellMultiPartRequest.java b/plugins/pell-multipart/src/main/java/org/apache/struts2/dispatcher/multipart/PellMultiPartRequest.java
index 3c733c6..c91c52e 100644
--- a/plugins/pell-multipart/src/main/java/org/apache/struts2/dispatcher/multipart/PellMultiPartRequest.java
+++ b/plugins/pell-multipart/src/main/java/org/apache/struts2/dispatcher/multipart/PellMultiPartRequest.java
@@ -154,11 +154,7 @@ public class PellMultiPartRequest extends AbstractMultiPartRequest {
             String inputValue = (String) fileParameterNames.nextElement();
             UploadedFile[] files = getFile(inputValue);
             for (UploadedFile currentFile : files) {
-                if (LOG.isInfoEnabled()) {
-                    String msg = LocalizedTextUtil.findText(this.getClass(), "struts.messages.removing.file", Locale.ENGLISH,
-                            "no.message.found", new Object[]{inputValue, currentFile});
-                    LOG.info(msg);
-                }
+                LOG.debug("Removing file {} {}", inputValue, currentFile);
                 if ((currentFile != null) && currentFile.isFile()) {
                     if (!currentFile.delete()) {
                         LOG.warn("Resource Leaking: Could not remove uploaded file [{}]", currentFile.getAbsolutePath());


[06/24] struts git commit: Updates test

Posted by lu...@apache.org.
Updates test


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

Branch: refs/heads/master
Commit: 2733f158d892efb2febdd99fc1772ed6564ea7be
Parents: 4ef6418
Author: Lukasz Lenart <lu...@apache.org>
Authored: Wed Mar 8 17:43:28 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Wed Mar 8 17:43:28 2017 +0100

----------------------------------------------------------------------
 .../xwork2/util/XWorkTestCaseHelper.java        |  2 +-
 .../xwork2/util/LocalizedTextUtilTest.java      | 54 +++++++++++---------
 .../DefaultBeanSelectionProviderTest.java       | 10 ++--
 .../org/apache/struts2/config/SettingsTest.java |  6 ++-
 .../struts2/dispatcher/DispatcherTest.java      |  8 +--
 5 files changed, 45 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/2733f158/core/src/main/java/com/opensymphony/xwork2/util/XWorkTestCaseHelper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/util/XWorkTestCaseHelper.java b/core/src/main/java/com/opensymphony/xwork2/util/XWorkTestCaseHelper.java
index d81b84e..717a3ef 100644
--- a/core/src/main/java/com/opensymphony/xwork2/util/XWorkTestCaseHelper.java
+++ b/core/src/main/java/com/opensymphony/xwork2/util/XWorkTestCaseHelper.java
@@ -40,7 +40,7 @@ public class XWorkTestCaseHelper {
         ActionContext.setContext(new ActionContext(stack.getContext()));
     
         // clear out localization
-        LocalizedTextUtil.reset();
+        container.getInstance(LocalizedTextUtil.class).reset();
         
     
         //ObjectFactory.setObjectFactory(container.getInstance(ObjectFactory.class));

http://git-wip-us.apache.org/repos/asf/struts/blob/2733f158/core/src/test/java/com/opensymphony/xwork2/util/LocalizedTextUtilTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/util/LocalizedTextUtilTest.java b/core/src/test/java/com/opensymphony/xwork2/util/LocalizedTextUtilTest.java
index c14d529..e8dc982 100644
--- a/core/src/test/java/com/opensymphony/xwork2/util/LocalizedTextUtilTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/util/LocalizedTextUtilTest.java
@@ -39,10 +39,12 @@ import java.util.ResourceBundle;
  */
 public class LocalizedTextUtilTest extends XWorkTestCase {
 
+    private LocalizedTextUtil localizedTextUtil;
+    
 	public void testNpeWhenClassIsPrimitive() throws Exception {
 		ValueStack stack = ActionContext.getContext().getValueStack();
 		stack.push(new MyObject());
-		String result = LocalizedTextUtil.findText(MyObject.class, "someObj.someI18nKey", Locale.ENGLISH, "default message", null, stack);
+		String result = localizedTextUtil.findText(MyObject.class, "someObj.someI18nKey", Locale.ENGLISH, "default message", null, stack);
 		System.out.println(result);
 	}
 	
@@ -96,7 +98,7 @@ public class LocalizedTextUtilTest extends XWorkTestCase {
     }
 
     public void testNullKeys() {
-        LocalizedTextUtil.findText(this.getClass(), null, Locale.getDefault());
+        localizedTextUtil.findText(this.getClass(), null, Locale.getDefault());
     }
 
     public void testActionGetTextXXX() throws Exception {
@@ -118,12 +120,12 @@ public class LocalizedTextUtilTest extends XWorkTestCase {
     }
 
     public void testAddDefaultResourceBundle() {
-        String text = LocalizedTextUtil.findDefaultText("foo.range", Locale.getDefault());
+        String text = localizedTextUtil.findDefaultText("foo.range", Locale.getDefault());
         assertNull("Found message when it should not be available.", text);
 
         LocalizedTextUtil.addDefaultResourceBundle("com/opensymphony/xwork2/SimpleAction");
 
-        String message = LocalizedTextUtil.findDefaultText("foo.range", Locale.US);
+        String message = localizedTextUtil.findDefaultText("foo.range", Locale.US);
         assertEquals("Foo Range Message", message);
     }
 
@@ -135,17 +137,17 @@ public class LocalizedTextUtilTest extends XWorkTestCase {
     }
 
     public void testDefaultMessage() throws Exception {
-        String message = LocalizedTextUtil.findDefaultText("xwork.error.action.execution", Locale.getDefault());
+        String message = localizedTextUtil.findDefaultText("xwork.error.action.execution", Locale.getDefault());
         assertEquals("Error during Action invocation", message);
     }
 
     public void testDefaultMessageOverride() throws Exception {
-        String message = LocalizedTextUtil.findDefaultText("xwork.error.action.execution", Locale.getDefault());
+        String message = localizedTextUtil.findDefaultText("xwork.error.action.execution", Locale.getDefault());
         assertEquals("Error during Action invocation", message);
 
         LocalizedTextUtil.addDefaultResourceBundle("com/opensymphony/xwork2/test");
 
-        message = LocalizedTextUtil.findDefaultText("xwork.error.action.execution", Locale.getDefault());
+        message = localizedTextUtil.findDefaultText("xwork.error.action.execution", Locale.getDefault());
         assertEquals("Testing resource bundle override", message);
     }
 
@@ -162,7 +164,7 @@ public class LocalizedTextUtilTest extends XWorkTestCase {
         ActionContext.getContext().getValueStack().push(action);
         ActionContext.getContext().getValueStack().push(action.getModel());
 
-        String message = LocalizedTextUtil.findText(ModelDrivenAction2.class, "invalid.fieldvalue.barObj.title", Locale.getDefault());
+        String message = localizedTextUtil.findText(ModelDrivenAction2.class, "invalid.fieldvalue.barObj.title", Locale.getDefault());
         assertEquals("Title is invalid!", message);
     }
 
@@ -172,7 +174,7 @@ public class LocalizedTextUtilTest extends XWorkTestCase {
         mockActionInvocation.expectAndReturn("getAction", action);
         ActionContext.getContext().setActionInvocation((ActionInvocation) mockActionInvocation.proxy());
 
-        String message = LocalizedTextUtil.findText(ModelDrivenAction2.class, "test.foo", Locale.getDefault());
+        String message = localizedTextUtil.findText(ModelDrivenAction2.class, "test.foo", Locale.getDefault());
         assertEquals("Foo!", message);
     }
 
@@ -183,46 +185,46 @@ public class LocalizedTextUtilTest extends XWorkTestCase {
         mockActionInvocation.expectAndReturn("getAction", action);
         ActionContext.getContext().setActionInvocation((ActionInvocation) mockActionInvocation.proxy());
 
-        String message = LocalizedTextUtil.findText(ModelDrivenAction2.class, "package.properties", Locale.getDefault());
+        String message = localizedTextUtil.findText(ModelDrivenAction2.class, "package.properties", Locale.getDefault());
         assertEquals("It works!", message);
     }
 
     public void testParameterizedDefaultMessage() throws Exception {
-        String message = LocalizedTextUtil.findDefaultText("xwork.exception.missing-action", Locale.getDefault(), new String[]{"AddUser"});
+        String message = localizedTextUtil.findDefaultText("xwork.exception.missing-action", Locale.getDefault(), new String[]{"AddUser"});
         assertEquals("There is no Action mapped for action name AddUser.", message);
     }
 
     public void testParameterizedDefaultMessageWithPackage() throws Exception {
-        String message = LocalizedTextUtil.findDefaultText("xwork.exception.missing-package-action", Locale.getDefault(), new String[]{"blah", "AddUser"});
+        String message = localizedTextUtil.findDefaultText("xwork.exception.missing-package-action", Locale.getDefault(), new String[]{"blah", "AddUser"});
         assertEquals("There is no Action mapped for namespace blah and action name AddUser.", message);
     }
 
     public void testLocalizedDateFormatIsUsed() throws ParseException {
-        LocalizedTextUtil.addDefaultResourceBundle("com/opensymphony/xwork2/util/LocalizedTextUtilTest");
+        localizedTextUtil.addDefaultResourceBundle("com/opensymphony/xwork2/util/localizedTextUtilTest");
         Date date = DateFormat.getDateInstance(DateFormat.SHORT, Locale.US).parse("01/01/2015");
         Object[] params = new Object[]{ date };
-        String usDate = LocalizedTextUtil.findDefaultText("test.format.date", Locale.US, params);
-        String germanDate = LocalizedTextUtil.findDefaultText("test.format.date", Locale.GERMANY, params);
+        String usDate = localizedTextUtil.findDefaultText("test.format.date", Locale.US, params);
+        String germanDate = localizedTextUtil.findDefaultText("test.format.date", Locale.GERMANY, params);
         assertEquals(usDate, "1/1/15");
         assertEquals(germanDate, "01.01.15");
     }
 
     public void testXW377() {
-        LocalizedTextUtil.addDefaultResourceBundle("com/opensymphony/xwork2/util/LocalizedTextUtilTest");
+        localizedTextUtil.addDefaultResourceBundle("com/opensymphony/xwork2/util/localizedTextUtilTest");
 
-        String text = LocalizedTextUtil.findText(Bar.class, "xw377", ActionContext.getContext().getLocale(), "xw377", null, ActionContext.getContext().getValueStack());
+        String text = localizedTextUtil.findText(Bar.class, "xw377", ActionContext.getContext().getLocale(), "xw377", null, ActionContext.getContext().getValueStack());
         assertEquals("xw377", text); // should not log
 
-        String text2 = LocalizedTextUtil.findText(LocalizedTextUtilTest.class, "notinbundle", ActionContext.getContext().getLocale(), "hello", null, ActionContext.getContext().getValueStack());
+        String text2 = localizedTextUtil.findText(LocalizedTextUtilTest.class, "notinbundle", ActionContext.getContext().getLocale(), "hello", null, ActionContext.getContext().getValueStack());
         assertEquals("hello", text2); // should log WARN
 
-        String text3 = LocalizedTextUtil.findText(LocalizedTextUtilTest.class, "notinbundle.key", ActionContext.getContext().getLocale(), "notinbundle.key", null, ActionContext.getContext().getValueStack());
+        String text3 = localizedTextUtil.findText(LocalizedTextUtilTest.class, "notinbundle.key", ActionContext.getContext().getLocale(), "notinbundle.key", null, ActionContext.getContext().getValueStack());
         assertEquals("notinbundle.key", text3); // should log WARN
 
-        String text4 = LocalizedTextUtil.findText(LocalizedTextUtilTest.class, "xw377", ActionContext.getContext().getLocale(), "hello", null, ActionContext.getContext().getValueStack());
+        String text4 = localizedTextUtil.findText(LocalizedTextUtilTest.class, "xw377", ActionContext.getContext().getLocale(), "hello", null, ActionContext.getContext().getValueStack());
         assertEquals("xw377", text4); // should not log
 
-        String text5 = LocalizedTextUtil.findText(LocalizedTextUtilTest.class, "username", ActionContext.getContext().getLocale(), null, null, ActionContext.getContext().getValueStack());
+        String text5 = localizedTextUtil.findText(LocalizedTextUtilTest.class, "username", ActionContext.getContext().getLocale(), null, null, ActionContext.getContext().getValueStack());
         assertEquals("Santa", text5); // should not log
     }
 
@@ -231,9 +233,9 @@ public class LocalizedTextUtilTest extends XWorkTestCase {
         // Before this fix loading the bundle for Germany failed since Italy have previously failed and thus the misses cache
         // contained a false entry
 
-        ResourceBundle rbFrance = LocalizedTextUtil.findResourceBundle("com/opensymphony/xwork2/util/XW404", Locale.FRANCE);
-        ResourceBundle rbItaly = LocalizedTextUtil.findResourceBundle("com/opensymphony/xwork2/util/XW404", Locale.ITALY);
-        ResourceBundle rbGermany = LocalizedTextUtil.findResourceBundle("com/opensymphony/xwork2/util/XW404", Locale.GERMANY);
+        ResourceBundle rbFrance = localizedTextUtil.findResourceBundle("com/opensymphony/xwork2/util/XW404", Locale.FRANCE);
+        ResourceBundle rbItaly = localizedTextUtil.findResourceBundle("com/opensymphony/xwork2/util/XW404", Locale.ITALY);
+        ResourceBundle rbGermany = localizedTextUtil.findResourceBundle("com/opensymphony/xwork2/util/XW404", Locale.GERMANY);
 
         assertNotNull(rbFrance);
         assertEquals("Bonjour", rbFrance.getString("hello"));
@@ -251,13 +253,15 @@ public class LocalizedTextUtilTest extends XWorkTestCase {
         container.inject(provider);
         loadConfigurationProviders(provider);
 
+        this.localizedTextUtil = container.inject(LocalizedTextUtil.class);
+        
         ActionContext.getContext().setLocale(Locale.US);
     }
 
     @Override
     protected void tearDown() throws Exception {
         super.tearDown();
-        LocalizedTextUtil.clearDefaultResourceBundles();
+        localizedTextUtil.clearDefaultResourceBundles();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/struts/blob/2733f158/core/src/test/java/org/apache/struts2/config/DefaultBeanSelectionProviderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/config/DefaultBeanSelectionProviderTest.java b/core/src/test/java/org/apache/struts2/config/DefaultBeanSelectionProviderTest.java
index f7c4066..6b4d29a 100644
--- a/core/src/test/java/org/apache/struts2/config/DefaultBeanSelectionProviderTest.java
+++ b/core/src/test/java/org/apache/struts2/config/DefaultBeanSelectionProviderTest.java
@@ -23,6 +23,7 @@ package org.apache.struts2.config;
 
 import java.util.Locale;
 
+import com.opensymphony.xwork2.XWorkTestCase;
 import org.apache.struts2.StrutsConstants;
 
 import com.opensymphony.xwork2.inject.ContainerBuilder;
@@ -31,12 +32,15 @@ import com.opensymphony.xwork2.util.location.LocatableProperties;
 
 import junit.framework.TestCase;
 
-public class DefaultBeanSelectionProviderTest extends TestCase {
+public class DefaultBeanSelectionProviderTest extends XWorkTestCase {
 
     public void testRegister() {
         LocalizedTextUtil.clearDefaultResourceBundles();
         LocalizedTextUtil.addDefaultResourceBundle("org/apache/struts2/struts-messages");
-        assertEquals("The form has already been processed or no token was supplied, please try again.", LocalizedTextUtil.findDefaultText("struts.messages.invalid.token", Locale.getDefault()));
+
+        LocalizedTextUtil localizedTextUtil = container.inject(LocalizedTextUtil.class);
+
+        assertEquals("The form has already been processed or no token was supplied, please try again.", localizedTextUtil.findDefaultText("struts.messages.invalid.token", Locale.getDefault()));
         
         LocatableProperties props = new LocatableProperties();
         props.setProperty(StrutsConstants.STRUTS_CUSTOM_I18N_RESOURCES, "testmessages,testmessages2");
@@ -44,7 +48,7 @@ public class DefaultBeanSelectionProviderTest extends TestCase {
         
         new DefaultBeanSelectionProvider().register(new ContainerBuilder(), props);
 
-        assertEquals("Replaced message for token tag", LocalizedTextUtil.findDefaultText("struts.messages.invalid.token", Locale.getDefault()));
+        assertEquals("Replaced message for token tag", localizedTextUtil.findDefaultText("struts.messages.invalid.token", Locale.getDefault()));
     }
 
 }

http://git-wip-us.apache.org/repos/asf/struts/blob/2733f158/core/src/test/java/org/apache/struts2/config/SettingsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/config/SettingsTest.java b/core/src/test/java/org/apache/struts2/config/SettingsTest.java
index 6c775f7..a5af5f7 100644
--- a/core/src/test/java/org/apache/struts2/config/SettingsTest.java
+++ b/core/src/test/java/org/apache/struts2/config/SettingsTest.java
@@ -52,9 +52,11 @@ public class SettingsTest extends StrutsInternalTestCase {
     public void testDefaultResourceBundlesLoaded() {
         Settings settings = new DefaultSettings();
 
+        LocalizedTextUtil localizedTextUtil = container.inject(LocalizedTextUtil.class);
+
         assertEquals("testmessages,testmessages2", settings.get(StrutsConstants.STRUTS_CUSTOM_I18N_RESOURCES));
-        assertEquals("This is a test message", LocalizedTextUtil.findDefaultText("default.testmessage", Locale.getDefault()));
-        assertEquals("This is another test message", LocalizedTextUtil.findDefaultText("default.testmessage2", Locale.getDefault()));
+        assertEquals("This is a test message", localizedTextUtil.findDefaultText("default.testmessage", Locale.getDefault()));
+        assertEquals("This is another test message", localizedTextUtil.findDefaultText("default.testmessage2", Locale.getDefault()));
     }
 
     public void testSetSettings() {

http://git-wip-us.apache.org/repos/asf/struts/blob/2733f158/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java b/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
index edcf987..c0994a5 100644
--- a/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
+++ b/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
@@ -55,14 +55,14 @@ import java.util.Map;
 public class DispatcherTest extends StrutsInternalTestCase {
 
     public void testDefaultResurceBundlePropertyLoaded() throws Exception {
+        LocalizedTextUtil localizedTextUtil = container.inject(LocalizedTextUtil.class);
+
         // some i18n messages from xwork-messages.properties
-        assertEquals(
-                LocalizedTextUtil.findDefaultText("xwork.error.action.execution", Locale.US),
+        assertEquals(localizedTextUtil.findDefaultText("xwork.error.action.execution", Locale.US),
                 "Error during Action invocation");
 
         // some i18n messages from struts-messages.properties
-        assertEquals(
-                LocalizedTextUtil.findDefaultText("struts.messages.error.uploading", Locale.US,
+        assertEquals(localizedTextUtil.findDefaultText("struts.messages.error.uploading", Locale.US,
                         new Object[] { "some error messages" }),
                 "Error uploading: some error messages");
     }


[16/24] struts git commit: Adjusts tests

Posted by lu...@apache.org.
Adjusts tests


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

Branch: refs/heads/master
Commit: f784a16cb7f6515bf15f93173453326286e33ff0
Parents: ca0f629
Author: Lukasz Lenart <lu...@apache.org>
Authored: Mon Mar 13 09:10:26 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Mon Mar 13 09:10:26 2017 +0100

----------------------------------------------------------------------
 .../xwork2/CompositeTextProviderTest.java       | 41 ++++----------------
 .../xwork2/DefaultTextProviderTest.java         |  7 ++--
 .../xwork2/TextProviderSupportTest.java         |  7 +++-
 3 files changed, 18 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/f784a16c/core/src/test/java/com/opensymphony/xwork2/CompositeTextProviderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/CompositeTextProviderTest.java b/core/src/test/java/com/opensymphony/xwork2/CompositeTextProviderTest.java
index 2dcfa8b..7290902 100644
--- a/core/src/test/java/com/opensymphony/xwork2/CompositeTextProviderTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/CompositeTextProviderTest.java
@@ -76,40 +76,15 @@ public class CompositeTextProviderTest extends XWorkTestCase {
     @Override
     protected void setUp() throws Exception {
         super.setUp();
-        textProvider = new CompositeTextProvider(new TextProvider[] {
-                new TextProviderSupport(ResourceBundle.getBundle("com.opensymphony.xwork2.validator.CompositeTextProviderTestResourceBundle1"),
-                        new LocaleProvider() {
-                            public Locale getLocale() {
-                                return Locale.ENGLISH;
-                            }
-
-                            @Override
-                            public boolean isValidLocaleString(String localeStr) {
-                                return true;
-                            }
-
-                            @Override
-                            public boolean isValidLocale(Locale locale) {
-                                return true;
-                            }
-                        }),
-                new TextProviderSupport(ResourceBundle.getBundle("com.opensymphony.xwork2.validator.CompositeTextProviderTestResourceBundle2"),
-                        new LocaleProvider() {
-                            public Locale getLocale() {
-                                return Locale.ENGLISH;
-                            }
-
-                            @Override
-                            public boolean isValidLocaleString(String localeStr) {
-                                return true;
-                            }
-
-                            @Override
-                            public boolean isValidLocale(Locale locale) {
-                                return true;
-                            }
-                        })
 
+        TextProviderFactory tpf = container.getInstance(TextProviderFactory.class);
+        tpf.setTextProvider(null);
+
+        ActionContext.getContext().setLocale(Locale.ENGLISH);
+
+        textProvider = new CompositeTextProvider(new TextProvider[]{
+                tpf.createInstance(ResourceBundle.getBundle("com.opensymphony.xwork2.validator.CompositeTextProviderTestResourceBundle1")),
+                tpf.createInstance(ResourceBundle.getBundle("com.opensymphony.xwork2.validator.CompositeTextProviderTestResourceBundle2"))
         });
     }
 

http://git-wip-us.apache.org/repos/asf/struts/blob/f784a16c/core/src/test/java/com/opensymphony/xwork2/DefaultTextProviderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/DefaultTextProviderTest.java b/core/src/test/java/com/opensymphony/xwork2/DefaultTextProviderTest.java
index 37d6dce..7b6b212 100644
--- a/core/src/test/java/com/opensymphony/xwork2/DefaultTextProviderTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/DefaultTextProviderTest.java
@@ -16,7 +16,6 @@
 package com.opensymphony.xwork2;
 
 import com.opensymphony.xwork2.util.LocalizedTextUtil;
-import junit.framework.TestCase;
 
 import java.util.*;
 
@@ -25,7 +24,7 @@ import java.util.*;
  *
  * @author Claus Ibsen
  */
-public class DefaultTextProviderTest extends TestCase {
+public class DefaultTextProviderTest extends XWorkTestCase {
 
     private DefaultTextProvider tp;
 
@@ -127,6 +126,8 @@ public class DefaultTextProviderTest extends TestCase {
 
     @Override
     protected void setUp() throws Exception {
+        super.setUp();
+
         ActionContext ctx = new ActionContext(new HashMap<String, Object>());
         ActionContext.setContext(ctx);
         ctx.setLocale(Locale.CANADA);
@@ -134,7 +135,7 @@ public class DefaultTextProviderTest extends TestCase {
         LocalizedTextUtil.clearDefaultResourceBundles();
         LocalizedTextUtil.addDefaultResourceBundle(DefaultTextProviderTest.class.getName());
 
-        tp = new DefaultTextProvider();
+        tp = container.inject(DefaultTextProvider.class);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/struts/blob/f784a16c/core/src/test/java/com/opensymphony/xwork2/TextProviderSupportTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/TextProviderSupportTest.java b/core/src/test/java/com/opensymphony/xwork2/TextProviderSupportTest.java
index 6769d0e..a36b437 100644
--- a/core/src/test/java/com/opensymphony/xwork2/TextProviderSupportTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/TextProviderSupportTest.java
@@ -16,6 +16,8 @@
 
 package com.opensymphony.xwork2;
 
+import com.opensymphony.xwork2.util.LocalizedTextUtil;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
@@ -108,6 +110,9 @@ public class TextProviderSupportTest extends XWorkTestCase {
     protected void setUp() throws Exception {
         super.setUp();
         rb = ResourceBundle.getBundle(TextProviderSupportTest.class.getName(), Locale.ENGLISH);
+
+        LocalizedTextUtil ltu = container.getInstance(LocalizedTextUtil.class);
+
         tp = new TextProviderSupport(rb, new LocaleProvider() {
             public Locale getLocale() {
                 return Locale.ENGLISH;
@@ -122,7 +127,7 @@ public class TextProviderSupportTest extends XWorkTestCase {
             public boolean isValidLocale(Locale locale) {
                 return true;
             }
-        });
+        }, ltu);
     }
 
     @Override


[04/24] struts git commit: Marks static methods as deprecated

Posted by lu...@apache.org.
Marks static methods as deprecated


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

Branch: refs/heads/master
Commit: 239327ea363e020af0a0de2669bc2e991bfe6bfb
Parents: fa1a5f9
Author: Lukasz Lenart <lu...@apache.org>
Authored: Wed Mar 8 17:42:42 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Wed Mar 8 17:42:42 2017 +0100

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


http://git-wip-us.apache.org/repos/asf/struts/blob/239327ea/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java b/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
index d69300f..1334cad 100644
--- a/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
+++ b/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
@@ -113,7 +113,10 @@ public class LocalizedTextUtil {
 
     /**
      * Clears the internal list of resource bundles.
+     *
+     * @deprecated used only in tests
      */
+    @Deprecated
     public static void clearDefaultResourceBundles() {
         ClassLoader ccl = getCurrentThreadContextClassLoader();
         List<String> bundles = new ArrayList<>();
@@ -121,17 +124,20 @@ public class LocalizedTextUtil {
         bundles.add(0, XWORK_MESSAGES_BUNDLE);
     }
 
+    public LocalizedTextUtil() {
+    }
+
     /**
      * Should resorce bundles be reloaded.
      *
      * @param reloadBundles reload bundles?
      */
-    @Inject(StrutsConstants.STRUTS_I18N_RELOAD)
+    @Inject(value = StrutsConstants.STRUTS_I18N_RELOAD, required = false)
     public void setReloadBundles(String reloadBundles) {
         this.reloadBundles = Boolean.parseBoolean(reloadBundles);
     }
 
-    @Inject(StrutsConstants.STRUTS_DEVMODE)
+    @Inject(value = StrutsConstants.STRUTS_DEVMODE, required = false)
     public void setDevMode(String devMode) {
         this.devMode = Boolean.parseBoolean(devMode);
     }
@@ -937,8 +943,11 @@ public class LocalizedTextUtil {
 
     /**
      * Clears all the internal lists.
+     *
+     * @deprecated used only in tests
      */
-    public static void reset() {
+    @Deprecated
+    public void reset() {
         clearDefaultResourceBundles();
         bundlesMap.clear();
         messageFormats.clear();


[09/24] struts git commit: Drops support for Xwork xml configuration

Posted by lu...@apache.org.
Drops support for Xwork xml configuration


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

Branch: refs/heads/master
Commit: 0b16543d6f5d48c3b2739871b7af609bf7b658b5
Parents: 741f3fa
Author: Lukasz Lenart <lu...@apache.org>
Authored: Wed Mar 8 17:52:24 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Wed Mar 8 17:52:24 2017 +0100

----------------------------------------------------------------------
 .../java/org/apache/struts2/dispatcher/Dispatcher.java    | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/0b16543d/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
index d0431f4..98ad701 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
@@ -375,21 +375,13 @@ public class Dispatcher {
         String[] files = configPaths.split("\\s*[,]\\s*");
         for (String file : files) {
             if (file.endsWith(".xml")) {
-                if ("xwork.xml".equals(file)) {
-                    configurationManager.addContainerProvider(createXmlConfigurationProvider(file, false));
-                } else {
-                    configurationManager.addContainerProvider(createStrutsXmlConfigurationProvider(file, false, servletContext));
-                }
+                configurationManager.addContainerProvider(createStrutsXmlConfigurationProvider(file, false, servletContext));
             } else {
                 throw new IllegalArgumentException("Invalid configuration file name");
             }
         }
     }
 
-    protected XmlConfigurationProvider createXmlConfigurationProvider(String filename, boolean errorIfMissing) {
-        return new XmlConfigurationProvider(filename, errorIfMissing);
-    }
-
     protected XmlConfigurationProvider createStrutsXmlConfigurationProvider(String filename, boolean errorIfMissing, ServletContext ctx) {
         return new StrutsXmlConfigurationProvider(filename, errorIfMissing, ctx);
     }


[18/24] struts git commit: Extracts common interface for LocalizedTextProvider

Posted by lu...@apache.org.
Extracts common interface for LocalizedTextProvider


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

Branch: refs/heads/master
Commit: 6e89179eb2c5f0a7b71b7d7fdd7b0e8966f68f52
Parents: 31ddb8b
Author: Lukasz Lenart <lu...@apache.org>
Authored: Tue Mar 14 09:39:02 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Tue Mar 14 09:39:02 2017 +0100

----------------------------------------------------------------------
 .../opensymphony/xwork2/DefaultActionProxy.java | 13 ++--
 .../xwork2/DefaultTextProvider.java             | 14 ++--
 .../xwork2/LocalizedTextProvider.java           | 33 +++++++++
 .../xwork2/TextProviderFactory.java             | 11 ++-
 .../xwork2/TextProviderSupport.java             | 37 +++++-----
 .../config/impl/DefaultConfiguration.java       |  2 +-
 .../providers/XWorkConfigurationProvider.java   |  3 +-
 .../xwork2/conversion/impl/XWorkConverter.java  |  4 +-
 .../xwork2/interceptor/AliasInterceptor.java    | 10 +--
 .../StaticParametersInterceptor.java            | 10 +--
 .../xwork2/util/LocalizedTextUtil.java          | 75 ++++++++++++--------
 .../xwork2/util/XWorkTestCaseHelper.java        |  2 +-
 .../config/DefaultBeanSelectionProvider.java    | 23 +-----
 .../struts2/factory/StrutsActionProxy.java      |  2 +-
 .../org/apache/struts2/util/TokenHelper.java    |  5 +-
 core/src/main/resources/struts-default.xml      |  2 +-
 .../xwork2/DefaultTextProviderTest.java         |  5 +-
 .../xwork2/TextProviderSupportTest.java         |  2 +-
 .../xwork2/util/LocalizedTextUtilTest.java      | 62 ++++++++--------
 .../struts2/components/ComponentTest.java       |  3 +-
 .../DefaultBeanSelectionProviderTest.java       | 30 ++++----
 .../org/apache/struts2/config/SettingsTest.java |  7 +-
 .../struts2/dispatcher/DispatcherTest.java      |  8 +--
 .../portlet/dispatcher/Jsr168Dispatcher.java    |  1 -
 24 files changed, 199 insertions(+), 165 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/6e89179e/core/src/main/java/com/opensymphony/xwork2/DefaultActionProxy.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/DefaultActionProxy.java b/core/src/main/java/com/opensymphony/xwork2/DefaultActionProxy.java
index 39a484d..1ab012c 100644
--- a/core/src/main/java/com/opensymphony/xwork2/DefaultActionProxy.java
+++ b/core/src/main/java/com/opensymphony/xwork2/DefaultActionProxy.java
@@ -24,7 +24,6 @@ import com.opensymphony.xwork2.config.Configuration;
 import com.opensymphony.xwork2.config.ConfigurationException;
 import com.opensymphony.xwork2.config.entities.ActionConfig;
 import com.opensymphony.xwork2.inject.Inject;
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
 import com.opensymphony.xwork2.util.profiling.UtilTimerStack;
 import org.apache.commons.lang3.StringEscapeUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -53,7 +52,7 @@ public class DefaultActionProxy implements ActionProxy, Serializable {
     protected ActionConfig config;
     protected ActionInvocation invocation;
     protected UnknownHandlerManager unknownHandlerManager;
-    protected LocalizedTextUtil localizedTextUtil;
+    protected LocalizedTextProvider localizedTextProvider;
 
     protected String actionName;
     protected String namespace;
@@ -116,8 +115,8 @@ public class DefaultActionProxy implements ActionProxy, Serializable {
     }
 
     @Inject
-    public void setLocalizedTextUtil(LocalizedTextUtil localizedTextUtil) {
-        this.localizedTextUtil = localizedTextUtil;
+    public void setLocalizedTextUtil(LocalizedTextProvider localizedTextProvider) {
+        this.localizedTextProvider = localizedTextProvider;
     }
 
     public Object getAction() {
@@ -212,7 +211,7 @@ public class DefaultActionProxy implements ActionProxy, Serializable {
     }
 
     protected String prepareNotAllowedErrorMessage() {
-        return localizedTextUtil.findDefaultText(
+        return localizedTextProvider.findDefaultText(
                 "struts.exception.method-not-allowed",
                 Locale.getDefault(),
                 new String[]{method, actionName}
@@ -221,12 +220,12 @@ public class DefaultActionProxy implements ActionProxy, Serializable {
 
     protected String getErrorMessage() {
         if ((namespace != null) && (namespace.trim().length() > 0)) {
-            return localizedTextUtil.findDefaultText(
+            return localizedTextProvider.findDefaultText(
                     "xwork.exception.missing-package-action",
                     Locale.getDefault(),
                     new String[]{namespace, actionName});
         } else {
-            return localizedTextUtil.findDefaultText(
+            return localizedTextProvider.findDefaultText(
                     "xwork.exception.missing-action",
                     Locale.getDefault(),
                     new String[]{actionName});

http://git-wip-us.apache.org/repos/asf/struts/blob/6e89179e/core/src/main/java/com/opensymphony/xwork2/DefaultTextProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/DefaultTextProvider.java b/core/src/main/java/com/opensymphony/xwork2/DefaultTextProvider.java
index 0e3f5b1..b82c42a 100644
--- a/core/src/main/java/com/opensymphony/xwork2/DefaultTextProvider.java
+++ b/core/src/main/java/com/opensymphony/xwork2/DefaultTextProvider.java
@@ -38,14 +38,14 @@ public class DefaultTextProvider implements TextProvider, Serializable, Unchaina
 
     private static final Object[] EMPTY_ARGS = new Object[0];
 
-    protected LocalizedTextUtil localizedTextUtil;
+    protected LocalizedTextProvider localizedTextProvider;
 
     public DefaultTextProvider() {
     }
 
     @Inject
-    public void setLocalizedTextUtil(LocalizedTextUtil localizedTextUtil) {
-        this.localizedTextUtil = localizedTextUtil;
+    public void setLocalizedTextUtil(LocalizedTextProvider localizedTextProvider) {
+        this.localizedTextProvider = localizedTextProvider;
     }
 
     public boolean hasKey(String key) {
@@ -53,7 +53,7 @@ public class DefaultTextProvider implements TextProvider, Serializable, Unchaina
     }
 
     public String getText(String key) {
-        return localizedTextUtil.findDefaultText(key, ActionContext.getContext().getLocale());
+        return localizedTextProvider.findDefaultText(key, ActionContext.getContext().getLocale());
     }
 
     public String getText(String key, String defaultValue) {
@@ -72,7 +72,7 @@ public class DefaultTextProvider implements TextProvider, Serializable, Unchaina
             params = EMPTY_ARGS;
         }
 
-        return localizedTextUtil.findDefaultText(key, ActionContext.getContext().getLocale(), params);
+        return localizedTextProvider.findDefaultText(key, ActionContext.getContext().getLocale(), params);
     }
 
     public String getText(String key, String[] args) {
@@ -83,7 +83,7 @@ public class DefaultTextProvider implements TextProvider, Serializable, Unchaina
             params = EMPTY_ARGS;
         }
 
-        return localizedTextUtil.findDefaultText(key, ActionContext.getContext().getLocale(), params);
+        return localizedTextProvider.findDefaultText(key, ActionContext.getContext().getLocale(), params);
     }
 
     public String getText(String key, String defaultValue, List<?> args) {
@@ -144,7 +144,7 @@ public class DefaultTextProvider implements TextProvider, Serializable, Unchaina
     }
 
     public ResourceBundle getTexts(String bundleName) {
-        return localizedTextUtil.findResourceBundle(bundleName, ActionContext.getContext().getLocale());
+        return localizedTextProvider.findResourceBundle(bundleName, ActionContext.getContext().getLocale());
     }
 
     public ResourceBundle getTexts() {

http://git-wip-us.apache.org/repos/asf/struts/blob/6e89179e/core/src/main/java/com/opensymphony/xwork2/LocalizedTextProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/LocalizedTextProvider.java b/core/src/main/java/com/opensymphony/xwork2/LocalizedTextProvider.java
new file mode 100644
index 0000000..f6175ea
--- /dev/null
+++ b/core/src/main/java/com/opensymphony/xwork2/LocalizedTextProvider.java
@@ -0,0 +1,33 @@
+package com.opensymphony.xwork2;
+
+import com.opensymphony.xwork2.util.ValueStack;
+
+import java.io.Serializable;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+public interface LocalizedTextProvider extends Serializable {
+
+    String findDefaultText(String aTextName, Locale locale);
+
+    String findDefaultText(String aTextName, Locale locale, Object[] params);
+
+    ResourceBundle findResourceBundle(String aBundleName, Locale locale);
+
+    String findText(Class aClass, String aTextName, Locale locale);
+
+    String findText(Class aClass, String aTextName, Locale locale, String defaultMessage, Object[] args);
+
+    String findText(Class aClass, String aTextName, Locale locale, String defaultMessage, Object[] args, ValueStack valueStack);
+
+    String findText(ResourceBundle bundle, String aTextName, Locale locale);
+
+    String findText(ResourceBundle bundle, String aTextName, Locale locale, String defaultMessage, Object[] args);
+
+    String findText(ResourceBundle bundle, String aTextName, Locale locale, String defaultMessage, Object[] args, ValueStack valueStack);
+
+    void addDefaultResourceBundle(String resourceBundleName);
+
+    @Deprecated
+    void reset();
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/6e89179e/core/src/main/java/com/opensymphony/xwork2/TextProviderFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/TextProviderFactory.java b/core/src/main/java/com/opensymphony/xwork2/TextProviderFactory.java
index 43c6792..91b110c 100644
--- a/core/src/main/java/com/opensymphony/xwork2/TextProviderFactory.java
+++ b/core/src/main/java/com/opensymphony/xwork2/TextProviderFactory.java
@@ -16,7 +16,6 @@
 package com.opensymphony.xwork2;
 
 import com.opensymphony.xwork2.inject.Inject;
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
 
 import java.util.ResourceBundle;
 
@@ -30,7 +29,7 @@ public class TextProviderFactory {
 
     private TextProvider textProvider;
     private LocaleProvider localeProvider;
-    private LocalizedTextUtil localizedTextUtil;
+    private LocalizedTextProvider localizedTextProvider;
 
     @Inject
     public void setTextProvider(TextProvider textProvider) {
@@ -43,8 +42,8 @@ public class TextProviderFactory {
     }
 
     @Inject
-    public void setLocalizedTextUtil(LocalizedTextUtil localizedTextUtil) {
-        this.localizedTextUtil = localizedTextUtil;
+    public void setLocalizedTextUtil(LocalizedTextProvider localizedTextProvider) {
+        this.localizedTextProvider = localizedTextProvider;
     }
 
     public TextProvider createInstance(Class clazz) {
@@ -67,7 +66,7 @@ public class TextProviderFactory {
 
     protected TextProvider getTextProvider(Class clazz) {
         if (this.textProvider == null) {
-            return new TextProviderSupport(clazz, localeProvider, localizedTextUtil);
+            return new TextProviderSupport(clazz, localeProvider, localizedTextProvider);
         } else {
             return textProvider;
         }
@@ -75,7 +74,7 @@ public class TextProviderFactory {
 
     private TextProvider getTextProvider(ResourceBundle bundle) {
         if (this.textProvider == null) {
-            return new TextProviderSupport(bundle, localeProvider, localizedTextUtil);
+            return new TextProviderSupport(bundle, localeProvider, localizedTextProvider);
         }
         return textProvider;
     }

http://git-wip-us.apache.org/repos/asf/struts/blob/6e89179e/core/src/main/java/com/opensymphony/xwork2/TextProviderSupport.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/TextProviderSupport.java b/core/src/main/java/com/opensymphony/xwork2/TextProviderSupport.java
index 98dd3d2..b576751 100644
--- a/core/src/main/java/com/opensymphony/xwork2/TextProviderSupport.java
+++ b/core/src/main/java/com/opensymphony/xwork2/TextProviderSupport.java
@@ -16,7 +16,6 @@
 package com.opensymphony.xwork2;
 
 import com.opensymphony.xwork2.inject.Inject;
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
 import com.opensymphony.xwork2.util.ValueStack;
 
 import java.util.*;
@@ -33,7 +32,7 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
     private Class clazz;
     private LocaleProvider localeProvider;
     private ResourceBundle bundle;
-    private LocalizedTextUtil localizedTextUtil;
+    private LocalizedTextProvider localizedTextProvider;
 
     /**
      * Default constructor
@@ -47,10 +46,10 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
      * @param clazz    a clazz to use for reading the resource bundle.
      * @param provider a locale provider.
      */
-    public TextProviderSupport(Class clazz, LocaleProvider provider, LocalizedTextUtil localizedTextUtil) {
+    public TextProviderSupport(Class clazz, LocaleProvider provider, LocalizedTextProvider localizedTextProvider) {
         this.clazz = clazz;
         this.localeProvider = provider;
-        this.localizedTextUtil = localizedTextUtil;
+        this.localizedTextProvider = localizedTextProvider;
     }
 
     /**
@@ -59,10 +58,10 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
      * @param bundle   the resource bundle.
      * @param provider a locale provider.
      */
-    public TextProviderSupport(ResourceBundle bundle, LocaleProvider provider, LocalizedTextUtil localizedTextUtil) {
+    public TextProviderSupport(ResourceBundle bundle, LocaleProvider provider, LocalizedTextProvider localizedTextProvider) {
         this.bundle = bundle;
         this.localeProvider = provider;
-        this.localizedTextUtil = localizedTextUtil;
+        this.localizedTextProvider = localizedTextProvider;
     }
 
     /**
@@ -89,8 +88,8 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
     }
 
     @Inject
-    public void setLocalizedTextUtil(LocalizedTextUtil localizedTextUtil) {
-        this.localizedTextUtil = localizedTextUtil;
+    public void setLocalizedTextUtil(LocalizedTextProvider localizedTextProvider) {
+        this.localizedTextProvider = localizedTextProvider;
     }
 
     /**
@@ -104,9 +103,9 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
     public boolean hasKey(String key) {
     	String message;
     	if (clazz != null) {
-            message = localizedTextUtil.findText(clazz, key, getLocale(), null, new Object[0] );
+            message = localizedTextProvider.findText(clazz, key, getLocale(), null, new Object[0] );
         } else {
-            message = localizedTextUtil.findText(bundle, key, getLocale(), null, new Object[0]);
+            message = localizedTextProvider.findText(bundle, key, getLocale(), null, new Object[0]);
         }
     	return message != null;
     }
@@ -208,9 +207,9 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
     public String getText(String key, String defaultValue, List<?> args) {
         Object[] argsArray = ((args != null && !args.equals(Collections.emptyList())) ? args.toArray() : null);
         if (clazz != null) {
-            return localizedTextUtil.findText(clazz, key, getLocale(), defaultValue, argsArray);
+            return localizedTextProvider.findText(clazz, key, getLocale(), defaultValue, argsArray);
         } else {
-            return localizedTextUtil.findText(bundle, key, getLocale(), defaultValue, argsArray);
+            return localizedTextProvider.findText(bundle, key, getLocale(), defaultValue, argsArray);
         }
     }
 
@@ -229,9 +228,9 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
      */
     public String getText(String key, String defaultValue, String[] args) {
         if (clazz != null) {
-            return localizedTextUtil.findText(clazz, key, getLocale(), defaultValue, args);
+            return localizedTextProvider.findText(clazz, key, getLocale(), defaultValue, args);
         } else {
-            return localizedTextUtil.findText(bundle, key, getLocale(), defaultValue, args);
+            return localizedTextProvider.findText(bundle, key, getLocale(), defaultValue, args);
         }
     }
 
@@ -259,9 +258,9 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
             locale = getLocale();
         }
         if (clazz != null) {
-            return localizedTextUtil.findText(clazz, key, locale, defaultValue, argsArray, stack);
+            return localizedTextProvider.findText(clazz, key, locale, defaultValue, argsArray, stack);
         } else {
-            return localizedTextUtil.findText(bundle, key, locale, defaultValue, argsArray, stack);
+            return localizedTextProvider.findText(bundle, key, locale, defaultValue, argsArray, stack);
         }
     }
 
@@ -289,9 +288,9 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
             locale = getLocale();
         }
         if (clazz != null) {
-            return localizedTextUtil.findText(clazz, key, locale, defaultValue, args, stack);
+            return localizedTextProvider.findText(clazz, key, locale, defaultValue, args, stack);
         } else {
-            return localizedTextUtil.findText(bundle, key, locale, defaultValue, args, stack);
+            return localizedTextProvider.findText(bundle, key, locale, defaultValue, args, stack);
         }
 
     }
@@ -311,7 +310,7 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
      * @return a resource bundle
      */
     public ResourceBundle getTexts(String aBundleName) {
-        return localizedTextUtil.findResourceBundle(aBundleName, getLocale());
+        return localizedTextProvider.findResourceBundle(aBundleName, getLocale());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/struts/blob/6e89179e/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java b/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
index 89be0fa..937a561 100644
--- a/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
+++ b/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
@@ -245,7 +245,7 @@ public class DefaultConfiguration implements Configuration {
         builder.factory(ReflectionProvider.class, OgnlReflectionProvider.class, Scope.SINGLETON);
         builder.factory(ValueStackFactory.class, OgnlValueStackFactory.class, Scope.SINGLETON);
 
-        builder.factory(LocalizedTextUtil.class, LocalizedTextUtil.class, Scope.SINGLETON);
+        builder.factory(LocalizedTextProvider.class, LocalizedTextUtil.class, Scope.SINGLETON);
 
         builder.factory(XWorkConverter.class, Scope.SINGLETON);
         builder.factory(ConversionPropertiesProcessor.class, DefaultConversionPropertiesProcessor.class, Scope.SINGLETON);

http://git-wip-us.apache.org/repos/asf/struts/blob/6e89179e/core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java b/core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java
index 2adab77..407a96d 100644
--- a/core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java
+++ b/core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java
@@ -71,6 +71,7 @@ import com.opensymphony.xwork2.ognl.accessor.XWorkListPropertyAccessor;
 import com.opensymphony.xwork2.ognl.accessor.XWorkMapPropertyAccessor;
 import com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor;
 import com.opensymphony.xwork2.util.CompoundRoot;
+import com.opensymphony.xwork2.LocalizedTextProvider;
 import com.opensymphony.xwork2.util.LocalizedTextUtil;
 import com.opensymphony.xwork2.util.OgnlTextParser;
 import com.opensymphony.xwork2.util.PatternMatcher;
@@ -181,7 +182,7 @@ public class XWorkConfigurationProvider implements ConfigurationProvider {
                 .factory(ActionValidatorManager.class, "no-annotations", DefaultActionValidatorManager.class, Scope.SINGLETON)
 
                 .factory(TextProviderFactory.class, Scope.SINGLETON)
-                .factory(LocalizedTextUtil.class, LocalizedTextUtil.class, Scope.SINGLETON)
+                .factory(LocalizedTextProvider.class, LocalizedTextUtil.class, Scope.SINGLETON)
                 .factory(TextProvider.class, "system", DefaultTextProvider.class, Scope.SINGLETON)
                 .factory(TextProvider.class, TextProviderSupport.class, Scope.SINGLETON)
 

http://git-wip-us.apache.org/repos/asf/struts/blob/6e89179e/core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java b/core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java
index 771fc36..bdf74c2 100644
--- a/core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java
+++ b/core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java
@@ -194,8 +194,8 @@ public class XWorkConverter extends DefaultTypeConverter {
     }
 
     public static String getConversionErrorMessage(String propertyName, ValueStack stack) {
-        LocalizedTextUtil localizedTextUtil = ActionContext.getContext().getContainer().getInstance(LocalizedTextUtil.class);
-        String defaultMessage = localizedTextUtil.findDefaultText("xwork.default.invalid.fieldvalue",
+        LocalizedTextProvider localizedTextProvider = ActionContext.getContext().getContainer().getInstance(LocalizedTextProvider.class);
+        String defaultMessage = localizedTextProvider.findDefaultText("xwork.default.invalid.fieldvalue",
                 ActionContext.getContext().getLocale(),
                 new Object[]{
                         propertyName

http://git-wip-us.apache.org/repos/asf/struts/blob/6e89179e/core/src/main/java/com/opensymphony/xwork2/interceptor/AliasInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/AliasInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/AliasInterceptor.java
index 9d260c1..f3f9c00 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/AliasInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/AliasInterceptor.java
@@ -23,7 +23,7 @@ import com.opensymphony.xwork2.config.entities.ActionConfig;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.ClearableValueStack;
 import com.opensymphony.xwork2.util.Evaluated;
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
+import com.opensymphony.xwork2.LocalizedTextProvider;
 import com.opensymphony.xwork2.util.ValueStack;
 import com.opensymphony.xwork2.util.ValueStackFactory;
 import com.opensymphony.xwork2.util.reflection.ReflectionContextState;
@@ -94,7 +94,7 @@ public class AliasInterceptor extends AbstractInterceptor {
     protected String aliasesKey = DEFAULT_ALIAS_KEY;
 
     protected ValueStackFactory valueStackFactory;
-    protected LocalizedTextUtil localizedTextUtil;
+    protected LocalizedTextProvider localizedTextProvider;
     protected boolean devMode = false;
 
     @Inject(XWorkConstants.DEV_MODE)
@@ -108,8 +108,8 @@ public class AliasInterceptor extends AbstractInterceptor {
     }
 
     @Inject
-    public void setLocalizedTextUtil(LocalizedTextUtil localizedTextUtil) {
-        this.localizedTextUtil = localizedTextUtil;
+    public void setLocalizedTextUtil(LocalizedTextProvider localizedTextProvider) {
+        this.localizedTextProvider = localizedTextProvider;
     }
 
     /**
@@ -179,7 +179,7 @@ public class AliasInterceptor extends AbstractInterceptor {
                             newStack.setValue(alias, value.get());
                         } catch (RuntimeException e) {
                             if (devMode) {
-                                String developerNotification = localizedTextUtil.findText(ParametersInterceptor.class, "devmode.notification", ActionContext.getContext().getLocale(), "Developer Notification:\n{0}", new Object[]{
+                                String developerNotification = localizedTextProvider.findText(ParametersInterceptor.class, "devmode.notification", ActionContext.getContext().getLocale(), "Developer Notification:\n{0}", new Object[]{
                                         "Unexpected Exception caught setting '" + entry.getKey() + "' on '" + action.getClass() + ": " + e.getMessage()
                                 });
                                 LOG.error(developerNotification);

http://git-wip-us.apache.org/repos/asf/struts/blob/6e89179e/core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java
index b697a64..1453583 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java
@@ -22,7 +22,7 @@ import com.opensymphony.xwork2.config.entities.ActionConfig;
 import com.opensymphony.xwork2.config.entities.Parameterizable;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.ClearableValueStack;
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
+import com.opensymphony.xwork2.LocalizedTextProvider;
 import com.opensymphony.xwork2.util.TextParseUtil;
 import com.opensymphony.xwork2.util.ValueStack;
 import com.opensymphony.xwork2.util.ValueStackFactory;
@@ -93,7 +93,7 @@ public class StaticParametersInterceptor extends AbstractInterceptor {
     private static final Logger LOG = LogManager.getLogger(StaticParametersInterceptor.class);
 
     private ValueStackFactory valueStackFactory;
-    private LocalizedTextUtil localizedTextUtil;
+    private LocalizedTextProvider localizedTextProvider;
 
     @Inject
     public void setValueStackFactory(ValueStackFactory valueStackFactory) {
@@ -106,8 +106,8 @@ public class StaticParametersInterceptor extends AbstractInterceptor {
     }
 
     @Inject
-    public void setLocalizedTextUtil(LocalizedTextUtil localizedTextUtil) {
-        this.localizedTextUtil = localizedTextUtil;
+    public void setLocalizedTextUtil(LocalizedTextProvider localizedTextProvider) {
+        this.localizedTextProvider = localizedTextProvider;
     }
 
     public void setParse(String value) {
@@ -175,7 +175,7 @@ public class StaticParametersInterceptor extends AbstractInterceptor {
                     } catch (RuntimeException e) {
                         if (devMode) {
 
-                            String developerNotification = localizedTextUtil.findText(ParametersInterceptor.class, "devmode.notification", ActionContext.getContext().getLocale(), "Developer Notification:\n{0}", new Object[]{
+                            String developerNotification = localizedTextProvider.findText(ParametersInterceptor.class, "devmode.notification", ActionContext.getContext().getLocale(), "Developer Notification:\n{0}", new Object[]{
                                     "Unexpected Exception caught setting '" + entry.getKey() + "' on '" + action.getClass() + ": " + e.getMessage()
                             });
                             LOG.error(developerNotification);

http://git-wip-us.apache.org/repos/asf/struts/blob/6e89179e/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java b/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
index 7e870fd..8fb9e00 100644
--- a/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
+++ b/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
@@ -23,6 +23,7 @@ package com.opensymphony.xwork2.util;
 
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.LocalizedTextProvider;
 import com.opensymphony.xwork2.ModelDriven;
 import com.opensymphony.xwork2.conversion.impl.XWorkConverter;
 import com.opensymphony.xwork2.inject.Inject;
@@ -33,7 +34,6 @@ import org.apache.logging.log4j.Logger;
 import org.apache.struts2.StrutsConstants;
 
 import java.beans.PropertyDescriptor;
-import java.io.Serializable;
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -88,29 +88,24 @@ import java.util.concurrent.CopyOnWriteArrayList;
  * @author Rainer Hermanns
  * @author tm_jee
  */
-public class LocalizedTextUtil implements Serializable {
+public class LocalizedTextUtil implements LocalizedTextProvider {
 
     private static final Logger LOG = LogManager.getLogger(LocalizedTextUtil.class);
 
     private static final String TOMCAT_RESOURCE_ENTRIES_FIELD = "resourceEntries";
 
-    private static final ConcurrentMap<Integer, List<String>> classLoaderMap = new ConcurrentHashMap<>();
+    private final ConcurrentMap<Integer, List<String>> classLoaderMap = new ConcurrentHashMap<>();
 
     private boolean reloadBundles = false;
     private boolean devMode = false;
 
-    private static final ConcurrentMap<String, ResourceBundle> bundlesMap = new ConcurrentHashMap<>();
-    private static final ConcurrentMap<MessageFormatKey, MessageFormat> messageFormats = new ConcurrentHashMap<>();
-    private static final ConcurrentMap<Integer, ClassLoader> delegatedClassLoaderMap = new ConcurrentHashMap<>();
-    private static final Set<String> missingBundles = Collections.synchronizedSet(new HashSet<String>());
-
-    private static final String RELOADED = "com.opensymphony.xwork2.util.LocalizedTextUtil.reloaded";
-    private static final String XWORK_MESSAGES_BUNDLE = "com/opensymphony/xwork2/xwork-messages";
-
-    static {
-        clearDefaultResourceBundles();
-    }
+    private final ConcurrentMap<String, ResourceBundle> bundlesMap = new ConcurrentHashMap<>();
+    private final ConcurrentMap<MessageFormatKey, MessageFormat> messageFormats = new ConcurrentHashMap<>();
+    private final ConcurrentMap<Integer, ClassLoader> delegatedClassLoaderMap = new ConcurrentHashMap<>();
+    private final Set<String> missingBundles = Collections.synchronizedSet(new HashSet<String>());
 
+    private final String RELOADED = "com.opensymphony.xwork2.util.LocalizedTextUtil.reloaded";
+    private final String XWORK_MESSAGES_BUNDLE = "com/opensymphony/xwork2/xwork-messages";
 
     /**
      * Clears the internal list of resource bundles.
@@ -119,13 +114,11 @@ public class LocalizedTextUtil implements Serializable {
      */
     @Deprecated
     public static void clearDefaultResourceBundles() {
-        ClassLoader ccl = getCurrentThreadContextClassLoader();
-        List<String> bundles = new ArrayList<>();
-        classLoaderMap.put(ccl.hashCode(), bundles);
-        bundles.add(0, XWORK_MESSAGES_BUNDLE);
+        // no-op
     }
 
     public LocalizedTextUtil() {
+        addDefaultResourceBundle("org/apache/struts2/struts-messages");
     }
 
     /**
@@ -143,6 +136,23 @@ public class LocalizedTextUtil implements Serializable {
         this.devMode = Boolean.parseBoolean(devMode);
     }
 
+    @Inject(value = StrutsConstants.STRUTS_CUSTOM_I18N_RESOURCES, required = false)
+    public void setCustomI18NBundles(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("Could not find messages file {}.properties. Skipping", name);
+                }
+            }
+        }
+    }
+
     /**
      * Add's the bundle to the internal list of default bundles.
      * <p>
@@ -151,7 +161,8 @@ public class LocalizedTextUtil implements Serializable {
      *
      * @param resourceBundleName the name of the bundle to add.
      */
-    public static void addDefaultResourceBundle(String resourceBundleName) {
+    @Override
+    public void addDefaultResourceBundle(String resourceBundleName) {
         //make sure this doesn't get added more than once
         final ClassLoader ccl = getCurrentThreadContextClassLoader();
         synchronized (XWORK_MESSAGES_BUNDLE) {
@@ -220,6 +231,7 @@ public class LocalizedTextUtil implements Serializable {
      * @param locale    the locale the message should be for
      * @return a localized message based on the specified key, or null if no localized message can be found for it
      */
+    @Override
     public String findDefaultText(String aTextName, Locale locale) {
         List<String> localList = classLoaderMap.get(Thread.currentThread().getContextClassLoader().hashCode());
 
@@ -253,6 +265,7 @@ public class LocalizedTextUtil implements Serializable {
      * @param params    an array of objects to be substituted into the message text
      * @return A formatted message based on the specified key, or null if no localized message can be found for it
      */
+    @Override
     public String findDefaultText(String aTextName, Locale locale, Object[] params) {
         String defaultText = findDefaultText(aTextName, locale);
         if (defaultText != null) {
@@ -272,6 +285,7 @@ public class LocalizedTextUtil implements Serializable {
      * @param locale      the locale.
      * @return the bundle, <tt>null</tt> if not found.
      */
+    @Override
     public ResourceBundle findResourceBundle(String aBundleName, Locale locale) {
         ClassLoader classLoader = getCurrentThreadContextClassLoader();
         String key = createMissesKey(String.valueOf(classLoader.hashCode()), aBundleName, locale);
@@ -312,7 +326,7 @@ public class LocalizedTextUtil implements Serializable {
     /**
      * @param classLoader a {@link ClassLoader} to look up the bundle from if none can be found on the current thread's classloader
      */
-    public static void setDelegatedClassLoader(final ClassLoader classLoader) {
+    public void setDelegatedClassLoader(final ClassLoader classLoader) {
         synchronized (bundlesMap) {
             delegatedClassLoaderMap.put(getCurrentThreadContextClassLoader().hashCode(), classLoader);
         }
@@ -321,7 +335,7 @@ public class LocalizedTextUtil implements Serializable {
     /**
      * @param bundleName Removes the bundle from any cached "misses"
      */
-    public static void clearBundle(final String bundleName) {
+    public void clearBundle(final String bundleName) {
         bundlesMap.remove(getCurrentThreadContextClassLoader().hashCode() + bundleName);
     }
 
@@ -349,6 +363,7 @@ public class LocalizedTextUtil implements Serializable {
      * @return the localized text, or null if none can be found and no defaultMessage is provided
      * @see #findText(Class aClass, String aTextName, Locale locale, String defaultMessage, Object[] args)
      */
+    @Override
     public String findText(Class aClass, String aTextName, Locale locale) {
         return findText(aClass, aTextName, locale, aTextName, new Object[0]);
     }
@@ -399,6 +414,7 @@ public class LocalizedTextUtil implements Serializable {
      *                       resource bundle
      * @return the localized text, or null if none can be found and no defaultMessage is provided
      */
+    @Override
     public String findText(Class aClass, String aTextName, Locale locale, String defaultMessage, Object[] args) {
         ValueStack valueStack = ActionContext.getContext().getValueStack();
         return findText(aClass, aTextName, locale, defaultMessage, args, valueStack);
@@ -456,8 +472,9 @@ public class LocalizedTextUtil implements Serializable {
      *                       one in the ActionContext ThreadLocal
      * @return the localized text, or null if none can be found and no defaultMessage is provided
      */
+    @Override
     public String findText(Class aClass, String aTextName, Locale locale, String defaultMessage, Object[] args,
-                                  ValueStack valueStack) {
+                           ValueStack valueStack) {
         String indexedTextName = null;
         if (aTextName == null) {
         	LOG.warn("Trying to find text with null key!");
@@ -641,6 +658,7 @@ public class LocalizedTextUtil implements Serializable {
      * @return the localized text, or null if none can be found and no defaultMessage is provided
      * @see #findText(java.util.ResourceBundle, String, java.util.Locale, String, Object[])
      */
+    @Override
     public String findText(ResourceBundle bundle, String aTextName, Locale locale) {
         return findText(bundle, aTextName, locale, aTextName, new Object[0]);
     }
@@ -667,6 +685,7 @@ public class LocalizedTextUtil implements Serializable {
      * @param args           arguments for the message formatter.
      * @return the localized text, or null if none can be found and no defaultMessage is provided
      */
+    @Override
     public String findText(ResourceBundle bundle, String aTextName, Locale locale, String defaultMessage, Object[] args) {
         ValueStack valueStack = ActionContext.getContext().getValueStack();
         return findText(bundle, aTextName, locale, defaultMessage, args, valueStack);
@@ -695,8 +714,9 @@ public class LocalizedTextUtil implements Serializable {
      * @param valueStack     the OGNL value stack.
      * @return the localized text, or null if none can be found and no defaultMessage is provided
      */
+    @Override
     public String findText(ResourceBundle bundle, String aTextName, Locale locale, String defaultMessage, Object[] args,
-                                  ValueStack valueStack) {
+                           ValueStack valueStack) {
         try {
             reloadBundles(valueStack.getContext());
 
@@ -773,7 +793,7 @@ public class LocalizedTextUtil implements Serializable {
         }
     }
 
-    private static String formatWithNullDetection(MessageFormat mf, Object[] args) {
+    private String formatWithNullDetection(MessageFormat mf, Object[] args) {
         String message = mf.format(args);
         if ("null".equals(message)) {
             return null;
@@ -782,7 +802,7 @@ public class LocalizedTextUtil implements Serializable {
         }
     }
 
-    private static MessageFormat buildMessageFormat(String pattern, Locale locale) {
+    private MessageFormat buildMessageFormat(String pattern, Locale locale) {
         MessageFormatKey key = new MessageFormatKey(pattern, locale);
         MessageFormat format = messageFormats.get(key);
         if (format == null) {
@@ -947,11 +967,10 @@ public class LocalizedTextUtil implements Serializable {
      *
      * @deprecated used only in tests
      */
+    @Override
     @Deprecated
     public void reset() {
-        clearDefaultResourceBundles();
-        bundlesMap.clear();
-        messageFormats.clear();
+        // no-op
     }
 
     static class MessageFormatKey {

http://git-wip-us.apache.org/repos/asf/struts/blob/6e89179e/core/src/main/java/com/opensymphony/xwork2/util/XWorkTestCaseHelper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/util/XWorkTestCaseHelper.java b/core/src/main/java/com/opensymphony/xwork2/util/XWorkTestCaseHelper.java
index 0cabd0f..4d0183c 100644
--- a/core/src/main/java/com/opensymphony/xwork2/util/XWorkTestCaseHelper.java
+++ b/core/src/main/java/com/opensymphony/xwork2/util/XWorkTestCaseHelper.java
@@ -40,7 +40,7 @@ public class XWorkTestCaseHelper {
         ActionContext.setContext(new ActionContext(stack.getContext()));
     
         // clear out localization
-        container.getInstance(LocalizedTextUtil.class).reset();
+        //container.getInstance(LocalizedTextUtil.class).reset();
         
     
         //ObjectFactory.setObjectFactory(container.getInstance(ObjectFactory.class));

http://git-wip-us.apache.org/repos/asf/struts/blob/6e89179e/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 d048f5f..b21376e 100644
--- a/core/src/main/java/org/apache/struts2/config/DefaultBeanSelectionProvider.java
+++ b/core/src/main/java/org/apache/struts2/config/DefaultBeanSelectionProvider.java
@@ -22,6 +22,7 @@
 package org.apache.struts2.config;
 
 import com.opensymphony.xwork2.ActionProxyFactory;
+import com.opensymphony.xwork2.LocalizedTextProvider;
 import com.opensymphony.xwork2.TextProviderFactory;
 import com.opensymphony.xwork2.factory.UnknownHandlerFactory;
 import com.opensymphony.xwork2.security.AcceptedPatternsChecker;
@@ -390,7 +391,7 @@ public class DefaultBeanSelectionProvider extends AbstractBeanSelectionProvider
         alias(TextProvider.class, StrutsConstants.STRUTS_XWORKTEXTPROVIDER, builder, props, Scope.PROTOTYPE);
         alias(TextProviderFactory.class, StrutsConstants.STRUTS_TEXT_PROVIDER_FACTORY, builder, props, Scope.PROTOTYPE);
         alias(LocaleProvider.class, StrutsConstants.STRUTS_LOCALE_PROVIDER, builder, props);
-        alias(LocalizedTextUtil.class, StrutsConstants.STRUTS_LOCALIZED_TEXT_PROVIDER, builder, props);
+        alias(LocalizedTextProvider.class, StrutsConstants.STRUTS_LOCALIZED_TEXT_PROVIDER, builder, props);
 
         alias(ActionProxyFactory.class, StrutsConstants.STRUTS_ACTIONPROXYFACTORY, builder, props);
         alias(ObjectTypeDeterminer.class, StrutsConstants.STRUTS_OBJECTTYPEDETERMINER, builder, props);
@@ -434,9 +435,6 @@ public class DefaultBeanSelectionProvider extends AbstractBeanSelectionProvider
         convertIfExist(props, StrutsConstants.STRUTS_ADDITIONAL_ACCEPTED_PATTERNS, XWorkConstants.ADDITIONAL_ACCEPTED_PATTERNS);
         convertIfExist(props, StrutsConstants.STRUTS_OVERRIDE_EXCLUDED_PATTERNS, XWorkConstants.OVERRIDE_EXCLUDED_PATTERNS);
         convertIfExist(props, StrutsConstants.STRUTS_OVERRIDE_ACCEPTED_PATTERNS, XWorkConstants.OVERRIDE_ACCEPTED_PATTERNS);
-
-        LocalizedTextUtil.addDefaultResourceBundle("org/apache/struts2/struts-messages");
-        loadCustomResourceBundles(props);
     }
 
     /**
@@ -462,21 +460,4 @@ public class DefaultBeanSelectionProvider extends AbstractBeanSelectionProvider
         }
     }
 
-    private void loadCustomResourceBundles(LocatableProperties props) {
-        String bundles = props.getProperty(StrutsConstants.STRUTS_CUSTOM_I18N_RESOURCES);
-        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);
-                    LocalizedTextUtil.addDefaultResourceBundle(name);
-                } catch (Exception e) {
-                    LOG.error("Could not find messages file {}.properties. Skipping", name);
-                }
-            }
-        }
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/struts/blob/6e89179e/core/src/main/java/org/apache/struts2/factory/StrutsActionProxy.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/factory/StrutsActionProxy.java b/core/src/main/java/org/apache/struts2/factory/StrutsActionProxy.java
index 64323c3..9b8e681 100644
--- a/core/src/main/java/org/apache/struts2/factory/StrutsActionProxy.java
+++ b/core/src/main/java/org/apache/struts2/factory/StrutsActionProxy.java
@@ -67,7 +67,7 @@ public class StrutsActionProxy extends DefaultActionProxy {
     protected String getErrorMessage() {
         if ((namespace != null) && (namespace.trim().length() > 0)) {
             String contextPath = ServletActionContext.getRequest().getContextPath();
-            return localizedTextUtil.findDefaultText(
+            return localizedTextProvider.findDefaultText(
                     "struts.exception.missing-package-action.with-context",
                     Locale.getDefault(),
                     new String[]{namespace, actionName, contextPath}

http://git-wip-us.apache.org/repos/asf/struts/blob/6e89179e/core/src/main/java/org/apache/struts2/util/TokenHelper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/util/TokenHelper.java b/core/src/main/java/org/apache/struts2/util/TokenHelper.java
index c6d0f0f..a5affaa 100644
--- a/core/src/main/java/org/apache/struts2/util/TokenHelper.java
+++ b/core/src/main/java/org/apache/struts2/util/TokenHelper.java
@@ -22,6 +22,7 @@
 package org.apache.struts2.util;
 
 import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.LocalizedTextProvider;
 import com.opensymphony.xwork2.util.LocalizedTextUtil;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
@@ -188,8 +189,8 @@ public class TokenHelper {
 
         if (!token.equals(sessionToken)) {
             if (LOG.isWarnEnabled()) {
-                LocalizedTextUtil localizedTextUtil = ActionContext.getContext().getContainer().getInstance(LocalizedTextUtil.class);
-                LOG.warn(localizedTextUtil.findText(TokenHelper.class, "struts.internal.invalid.token", ActionContext.getContext().getLocale(), "Form token {0} does not match the session token {1}.", new Object[]{
+                LocalizedTextProvider localizedTextProvider = ActionContext.getContext().getContainer().getInstance(LocalizedTextProvider.class);
+                LOG.warn(localizedTextProvider.findText(TokenHelper.class, "struts.internal.invalid.token", ActionContext.getContext().getLocale(), "Form token {0} does not match the session token {1}.", new Object[]{
                         token, sessionToken
                 }));
             }

http://git-wip-us.apache.org/repos/asf/struts/blob/6e89179e/core/src/main/resources/struts-default.xml
----------------------------------------------------------------------
diff --git a/core/src/main/resources/struts-default.xml b/core/src/main/resources/struts-default.xml
index 0efdfba..4a20ac9 100644
--- a/core/src/main/resources/struts-default.xml
+++ b/core/src/main/resources/struts-default.xml
@@ -131,7 +131,7 @@
     <bean type="com.opensymphony.xwork2.conversion.impl.StringConverter" name="struts" class="com.opensymphony.xwork2.conversion.impl.StringConverter" scope="singleton"/>
 
     <bean type="com.opensymphony.xwork2.TextProviderFactory" name="struts" class="com.opensymphony.xwork2.TextProviderFactory" scope="prototype" />
-    <bean type="com.opensymphony.xwork2.util.LocalizedTextUtil" name="struts" class="com.opensymphony.xwork2.util.LocalizedTextUtil" scope="singleton" />
+    <bean type="com.opensymphony.xwork2.LocalizedTextProvider" name="struts" class="com.opensymphony.xwork2.util.LocalizedTextUtil" scope="singleton" />
     <bean type="com.opensymphony.xwork2.TextProvider" name="struts" class="com.opensymphony.xwork2.TextProviderSupport" scope="prototype" />
     <bean type="com.opensymphony.xwork2.LocaleProvider" name="struts" class="com.opensymphony.xwork2.DefaultLocaleProvider" scope="singleton" />
 

http://git-wip-us.apache.org/repos/asf/struts/blob/6e89179e/core/src/test/java/com/opensymphony/xwork2/DefaultTextProviderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/DefaultTextProviderTest.java b/core/src/test/java/com/opensymphony/xwork2/DefaultTextProviderTest.java
index 7b6b212..2b4ac0f 100644
--- a/core/src/test/java/com/opensymphony/xwork2/DefaultTextProviderTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/DefaultTextProviderTest.java
@@ -15,8 +15,6 @@
  */
 package com.opensymphony.xwork2;
 
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
-
 import java.util.*;
 
 /**
@@ -132,8 +130,7 @@ public class DefaultTextProviderTest extends XWorkTestCase {
         ActionContext.setContext(ctx);
         ctx.setLocale(Locale.CANADA);
 
-        LocalizedTextUtil.clearDefaultResourceBundles();
-        LocalizedTextUtil.addDefaultResourceBundle(DefaultTextProviderTest.class.getName());
+        container.getInstance(LocalizedTextProvider.class).addDefaultResourceBundle(DefaultTextProviderTest.class.getName());
 
         tp = container.inject(DefaultTextProvider.class);
     }

http://git-wip-us.apache.org/repos/asf/struts/blob/6e89179e/core/src/test/java/com/opensymphony/xwork2/TextProviderSupportTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/TextProviderSupportTest.java b/core/src/test/java/com/opensymphony/xwork2/TextProviderSupportTest.java
index a36b437..c0ea23d 100644
--- a/core/src/test/java/com/opensymphony/xwork2/TextProviderSupportTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/TextProviderSupportTest.java
@@ -111,7 +111,7 @@ public class TextProviderSupportTest extends XWorkTestCase {
         super.setUp();
         rb = ResourceBundle.getBundle(TextProviderSupportTest.class.getName(), Locale.ENGLISH);
 
-        LocalizedTextUtil ltu = container.getInstance(LocalizedTextUtil.class);
+        LocalizedTextProvider ltu = container.getInstance(LocalizedTextProvider.class);
 
         tp = new TextProviderSupport(rb, new LocaleProvider() {
             public Locale getLocale() {

http://git-wip-us.apache.org/repos/asf/struts/blob/6e89179e/core/src/test/java/com/opensymphony/xwork2/util/LocalizedTextUtilTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/util/LocalizedTextUtilTest.java b/core/src/test/java/com/opensymphony/xwork2/util/LocalizedTextUtilTest.java
index 6631815..75e5569 100644
--- a/core/src/test/java/com/opensymphony/xwork2/util/LocalizedTextUtilTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/util/LocalizedTextUtilTest.java
@@ -39,12 +39,12 @@ import java.util.ResourceBundle;
  */
 public class LocalizedTextUtilTest extends XWorkTestCase {
 
-    private LocalizedTextUtil localizedTextUtil;
+    private LocalizedTextProvider localizedTextProvider;
     
 	public void testNpeWhenClassIsPrimitive() throws Exception {
 		ValueStack stack = ActionContext.getContext().getValueStack();
 		stack.push(new MyObject());
-		String result = localizedTextUtil.findText(MyObject.class, "someObj.someI18nKey", Locale.ENGLISH, "default message", null, stack);
+		String result = localizedTextProvider.findText(MyObject.class, "someObj.someI18nKey", Locale.ENGLISH, "default message", null, stack);
 		System.out.println(result);
 	}
 	
@@ -98,11 +98,11 @@ public class LocalizedTextUtilTest extends XWorkTestCase {
     }
 
     public void testNullKeys() {
-        localizedTextUtil.findText(this.getClass(), null, Locale.getDefault());
+        localizedTextProvider.findText(this.getClass(), null, Locale.getDefault());
     }
 
     public void testActionGetTextXXX() throws Exception {
-        LocalizedTextUtil.addDefaultResourceBundle("com/opensymphony/xwork2/util/FindMe");
+        localizedTextProvider.addDefaultResourceBundle("com/opensymphony/xwork2/util/FindMe");
 
         SimpleAction action = new SimpleAction();
         container.inject(action);
@@ -120,34 +120,34 @@ public class LocalizedTextUtilTest extends XWorkTestCase {
     }
 
     public void testAddDefaultResourceBundle() {
-        String text = localizedTextUtil.findDefaultText("foo.range", Locale.getDefault());
+        String text = localizedTextProvider.findDefaultText("foo.range", Locale.getDefault());
         assertNull("Found message when it should not be available.", text);
 
-        LocalizedTextUtil.addDefaultResourceBundle("com/opensymphony/xwork2/SimpleAction");
+        localizedTextProvider.addDefaultResourceBundle("com/opensymphony/xwork2/SimpleAction");
 
-        String message = localizedTextUtil.findDefaultText("foo.range", Locale.US);
+        String message = localizedTextProvider.findDefaultText("foo.range", Locale.US);
         assertEquals("Foo Range Message", message);
     }
 
     public void testAddDefaultResourceBundle2() throws Exception {
-        LocalizedTextUtil.addDefaultResourceBundle("com/opensymphony/xwork2/SimpleAction");
+        localizedTextProvider.addDefaultResourceBundle("com/opensymphony/xwork2/SimpleAction");
 
         ActionProxy proxy = actionProxyFactory.createActionProxy("/", "packagelessAction", null, new HashMap<String, Object>(), false, true);
         proxy.execute();
     }
 
     public void testDefaultMessage() throws Exception {
-        String message = localizedTextUtil.findDefaultText("xwork.error.action.execution", Locale.getDefault());
+        String message = localizedTextProvider.findDefaultText("xwork.error.action.execution", Locale.getDefault());
         assertEquals("Error during Action invocation", message);
     }
 
     public void testDefaultMessageOverride() throws Exception {
-        String message = localizedTextUtil.findDefaultText("xwork.error.action.execution", Locale.getDefault());
+        String message = localizedTextProvider.findDefaultText("xwork.error.action.execution", Locale.getDefault());
         assertEquals("Error during Action invocation", message);
 
-        LocalizedTextUtil.addDefaultResourceBundle("com/opensymphony/xwork2/test");
+        localizedTextProvider.addDefaultResourceBundle("com/opensymphony/xwork2/test");
 
-        message = localizedTextUtil.findDefaultText("xwork.error.action.execution", Locale.getDefault());
+        message = localizedTextProvider.findDefaultText("xwork.error.action.execution", Locale.getDefault());
         assertEquals("Testing resource bundle override", message);
     }
 
@@ -164,7 +164,7 @@ public class LocalizedTextUtilTest extends XWorkTestCase {
         ActionContext.getContext().getValueStack().push(action);
         ActionContext.getContext().getValueStack().push(action.getModel());
 
-        String message = localizedTextUtil.findText(ModelDrivenAction2.class, "invalid.fieldvalue.barObj.title", Locale.getDefault());
+        String message = localizedTextProvider.findText(ModelDrivenAction2.class, "invalid.fieldvalue.barObj.title", Locale.getDefault());
         assertEquals("Title is invalid!", message);
     }
 
@@ -174,7 +174,7 @@ public class LocalizedTextUtilTest extends XWorkTestCase {
         mockActionInvocation.expectAndReturn("getAction", action);
         ActionContext.getContext().setActionInvocation((ActionInvocation) mockActionInvocation.proxy());
 
-        String message = localizedTextUtil.findText(ModelDrivenAction2.class, "test.foo", Locale.getDefault());
+        String message = localizedTextProvider.findText(ModelDrivenAction2.class, "test.foo", Locale.getDefault());
         assertEquals("Foo!", message);
     }
 
@@ -185,46 +185,46 @@ public class LocalizedTextUtilTest extends XWorkTestCase {
         mockActionInvocation.expectAndReturn("getAction", action);
         ActionContext.getContext().setActionInvocation((ActionInvocation) mockActionInvocation.proxy());
 
-        String message = localizedTextUtil.findText(ModelDrivenAction2.class, "package.properties", Locale.getDefault());
+        String message = localizedTextProvider.findText(ModelDrivenAction2.class, "package.properties", Locale.getDefault());
         assertEquals("It works!", message);
     }
 
     public void testParameterizedDefaultMessage() throws Exception {
-        String message = localizedTextUtil.findDefaultText("xwork.exception.missing-action", Locale.getDefault(), new String[]{"AddUser"});
+        String message = localizedTextProvider.findDefaultText("xwork.exception.missing-action", Locale.getDefault(), new String[]{"AddUser"});
         assertEquals("There is no Action mapped for action name AddUser.", message);
     }
 
     public void testParameterizedDefaultMessageWithPackage() throws Exception {
-        String message = localizedTextUtil.findDefaultText("xwork.exception.missing-package-action", Locale.getDefault(), new String[]{"blah", "AddUser"});
+        String message = localizedTextProvider.findDefaultText("xwork.exception.missing-package-action", Locale.getDefault(), new String[]{"blah", "AddUser"});
         assertEquals("There is no Action mapped for namespace blah and action name AddUser.", message);
     }
 
     public void testLocalizedDateFormatIsUsed() throws ParseException {
-        LocalizedTextUtil.addDefaultResourceBundle("com/opensymphony/xwork2/util/LocalizedTextUtilTest");
+        localizedTextProvider.addDefaultResourceBundle("com/opensymphony/xwork2/util/LocalizedTextUtilTest");
         Date date = DateFormat.getDateInstance(DateFormat.SHORT, Locale.US).parse("01/01/2015");
         Object[] params = new Object[]{ date };
-        String usDate = localizedTextUtil.findDefaultText("test.format.date", Locale.US, params);
-        String germanDate = localizedTextUtil.findDefaultText("test.format.date", Locale.GERMANY, params);
+        String usDate = localizedTextProvider.findDefaultText("test.format.date", Locale.US, params);
+        String germanDate = localizedTextProvider.findDefaultText("test.format.date", Locale.GERMANY, params);
         assertEquals(usDate, "1/1/15");
         assertEquals(germanDate, "01.01.15");
     }
 
     public void testXW377() {
-        LocalizedTextUtil.addDefaultResourceBundle("com/opensymphony/xwork2/util/LocalizedTextUtilTest");
+        localizedTextProvider.addDefaultResourceBundle("com/opensymphony/xwork2/util/LocalizedTextUtilTest");
 
-        String text = localizedTextUtil.findText(Bar.class, "xw377", ActionContext.getContext().getLocale(), "xw377", null, ActionContext.getContext().getValueStack());
+        String text = localizedTextProvider.findText(Bar.class, "xw377", ActionContext.getContext().getLocale(), "xw377", null, ActionContext.getContext().getValueStack());
         assertEquals("xw377", text); // should not log
 
-        String text2 = localizedTextUtil.findText(LocalizedTextUtilTest.class, "notinbundle", ActionContext.getContext().getLocale(), "hello", null, ActionContext.getContext().getValueStack());
+        String text2 = localizedTextProvider.findText(LocalizedTextUtilTest.class, "notinbundle", ActionContext.getContext().getLocale(), "hello", null, ActionContext.getContext().getValueStack());
         assertEquals("hello", text2); // should log WARN
 
-        String text3 = localizedTextUtil.findText(LocalizedTextUtilTest.class, "notinbundle.key", ActionContext.getContext().getLocale(), "notinbundle.key", null, ActionContext.getContext().getValueStack());
+        String text3 = localizedTextProvider.findText(LocalizedTextUtilTest.class, "notinbundle.key", ActionContext.getContext().getLocale(), "notinbundle.key", null, ActionContext.getContext().getValueStack());
         assertEquals("notinbundle.key", text3); // should log WARN
 
-        String text4 = localizedTextUtil.findText(LocalizedTextUtilTest.class, "xw377", ActionContext.getContext().getLocale(), "hello", null, ActionContext.getContext().getValueStack());
+        String text4 = localizedTextProvider.findText(LocalizedTextUtilTest.class, "xw377", ActionContext.getContext().getLocale(), "hello", null, ActionContext.getContext().getValueStack());
         assertEquals("xw377", text4); // should not log
 
-        String text5 = localizedTextUtil.findText(LocalizedTextUtilTest.class, "username", ActionContext.getContext().getLocale(), null, null, ActionContext.getContext().getValueStack());
+        String text5 = localizedTextProvider.findText(LocalizedTextUtilTest.class, "username", ActionContext.getContext().getLocale(), null, null, ActionContext.getContext().getValueStack());
         assertEquals("Santa", text5); // should not log
     }
 
@@ -233,9 +233,9 @@ public class LocalizedTextUtilTest extends XWorkTestCase {
         // Before this fix loading the bundle for Germany failed since Italy have previously failed and thus the misses cache
         // contained a false entry
 
-        ResourceBundle rbFrance = localizedTextUtil.findResourceBundle("com/opensymphony/xwork2/util/XW404", Locale.FRANCE);
-        ResourceBundle rbItaly = localizedTextUtil.findResourceBundle("com/opensymphony/xwork2/util/XW404", Locale.ITALY);
-        ResourceBundle rbGermany = localizedTextUtil.findResourceBundle("com/opensymphony/xwork2/util/XW404", Locale.GERMANY);
+        ResourceBundle rbFrance = localizedTextProvider.findResourceBundle("com/opensymphony/xwork2/util/XW404", Locale.FRANCE);
+        ResourceBundle rbItaly = localizedTextProvider.findResourceBundle("com/opensymphony/xwork2/util/XW404", Locale.ITALY);
+        ResourceBundle rbGermany = localizedTextProvider.findResourceBundle("com/opensymphony/xwork2/util/XW404", Locale.GERMANY);
 
         assertNotNull(rbFrance);
         assertEquals("Bonjour", rbFrance.getString("hello"));
@@ -253,7 +253,7 @@ public class LocalizedTextUtilTest extends XWorkTestCase {
         container.inject(provider);
         loadConfigurationProviders(provider);
 
-        this.localizedTextUtil = container.inject(LocalizedTextUtil.class);
+        localizedTextProvider = container.getInstance(LocalizedTextProvider.class);
         
         ActionContext.getContext().setLocale(Locale.US);
     }
@@ -261,7 +261,7 @@ public class LocalizedTextUtilTest extends XWorkTestCase {
     @Override
     protected void tearDown() throws Exception {
         super.tearDown();
-        LocalizedTextUtil.clearDefaultResourceBundles();
+        localizedTextProvider = null;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/struts/blob/6e89179e/core/src/test/java/org/apache/struts2/components/ComponentTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/components/ComponentTest.java b/core/src/test/java/org/apache/struts2/components/ComponentTest.java
index a789712..80cf82b 100644
--- a/core/src/test/java/org/apache/struts2/components/ComponentTest.java
+++ b/core/src/test/java/org/apache/struts2/components/ComponentTest.java
@@ -27,6 +27,7 @@ import java.util.Stack;
 
 import javax.servlet.jsp.tagext.TagSupport;
 
+import com.opensymphony.xwork2.LocalizedTextProvider;
 import org.apache.struts2.views.jsp.AbstractTagTest;
 import org.apache.struts2.views.jsp.BeanTag;
 import org.apache.struts2.views.jsp.ElseIfTag;
@@ -439,7 +440,7 @@ public class ComponentTest extends AbstractTagTest {
         t.setPageContext(pageContext);
         t.setName("textFieldName");
 
-        LocalizedTextUtil.addDefaultResourceBundle("org.apache.struts2.components.temp");
+        container.getInstance(LocalizedTextProvider.class).addDefaultResourceBundle("org.apache.struts2.components.temp");
 
         I18nTag tag = new I18nTag();
         tag.setName("org.apache.struts2.components.tempo");

http://git-wip-us.apache.org/repos/asf/struts/blob/6e89179e/core/src/test/java/org/apache/struts2/config/DefaultBeanSelectionProviderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/config/DefaultBeanSelectionProviderTest.java b/core/src/test/java/org/apache/struts2/config/DefaultBeanSelectionProviderTest.java
index 6b4d29a..771c056 100644
--- a/core/src/test/java/org/apache/struts2/config/DefaultBeanSelectionProviderTest.java
+++ b/core/src/test/java/org/apache/struts2/config/DefaultBeanSelectionProviderTest.java
@@ -24,31 +24,35 @@ package org.apache.struts2.config;
 import java.util.Locale;
 
 import com.opensymphony.xwork2.XWorkTestCase;
+import com.opensymphony.xwork2.LocalizedTextProvider;
+import com.opensymphony.xwork2.config.Configuration;
+import com.opensymphony.xwork2.config.ConfigurationException;
+import com.opensymphony.xwork2.config.ConfigurationProvider;
+import com.opensymphony.xwork2.test.StubConfigurationProvider;
 import org.apache.struts2.StrutsConstants;
 
 import com.opensymphony.xwork2.inject.ContainerBuilder;
 import com.opensymphony.xwork2.util.LocalizedTextUtil;
 import com.opensymphony.xwork2.util.location.LocatableProperties;
 
-import junit.framework.TestCase;
-
 public class DefaultBeanSelectionProviderTest extends XWorkTestCase {
 
     public void testRegister() {
-        LocalizedTextUtil.clearDefaultResourceBundles();
-        LocalizedTextUtil.addDefaultResourceBundle("org/apache/struts2/struts-messages");
-
-        LocalizedTextUtil localizedTextUtil = container.inject(LocalizedTextUtil.class);
+        LocalizedTextProvider localizedTextProvider = container.getInstance(LocalizedTextProvider.class);
 
-        assertEquals("The form has already been processed or no token was supplied, please try again.", localizedTextUtil.findDefaultText("struts.messages.invalid.token", Locale.getDefault()));
+        assertEquals("The form has already been processed or no token was supplied, please try again.", localizedTextProvider.findDefaultText("struts.messages.invalid.token", Locale.getDefault()));
         
-        LocatableProperties props = new LocatableProperties();
-        props.setProperty(StrutsConstants.STRUTS_CUSTOM_I18N_RESOURCES, "testmessages,testmessages2");
-        props.setProperty(StrutsConstants.STRUTS_LOCALE, "US");
-        
-        new DefaultBeanSelectionProvider().register(new ContainerBuilder(), props);
+        loadConfigurationProviders(new StubConfigurationProvider() {
+            @Override
+            public void register(ContainerBuilder builder, LocatableProperties props) throws ConfigurationException {
+                props.setProperty(StrutsConstants.STRUTS_CUSTOM_I18N_RESOURCES, "testmessages,testmessages2");
+                props.setProperty(StrutsConstants.STRUTS_LOCALE, "US");
+            }
+        });
+
+        localizedTextProvider = container.getInstance(LocalizedTextProvider.class);
 
-        assertEquals("Replaced message for token tag", localizedTextUtil.findDefaultText("struts.messages.invalid.token", Locale.getDefault()));
+        assertEquals("Replaced message for token tag", localizedTextProvider.findDefaultText("struts.messages.invalid.token", Locale.getDefault()));
     }
 
 }

http://git-wip-us.apache.org/repos/asf/struts/blob/6e89179e/core/src/test/java/org/apache/struts2/config/SettingsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/config/SettingsTest.java b/core/src/test/java/org/apache/struts2/config/SettingsTest.java
index a5af5f7..9f92f7d 100644
--- a/core/src/test/java/org/apache/struts2/config/SettingsTest.java
+++ b/core/src/test/java/org/apache/struts2/config/SettingsTest.java
@@ -21,6 +21,7 @@
 
 package org.apache.struts2.config;
 
+import com.opensymphony.xwork2.LocalizedTextProvider;
 import com.opensymphony.xwork2.util.LocalizedTextUtil;
 import org.apache.struts2.StrutsConstants;
 import org.apache.struts2.StrutsInternalTestCase;
@@ -52,11 +53,11 @@ public class SettingsTest extends StrutsInternalTestCase {
     public void testDefaultResourceBundlesLoaded() {
         Settings settings = new DefaultSettings();
 
-        LocalizedTextUtil localizedTextUtil = container.inject(LocalizedTextUtil.class);
+        LocalizedTextProvider localizedTextProvider = container.getInstance(LocalizedTextProvider.class);
 
         assertEquals("testmessages,testmessages2", settings.get(StrutsConstants.STRUTS_CUSTOM_I18N_RESOURCES));
-        assertEquals("This is a test message", localizedTextUtil.findDefaultText("default.testmessage", Locale.getDefault()));
-        assertEquals("This is another test message", localizedTextUtil.findDefaultText("default.testmessage2", Locale.getDefault()));
+        assertEquals("This is a test message", localizedTextProvider.findDefaultText("default.testmessage", Locale.getDefault()));
+        assertEquals("This is another test message", localizedTextProvider.findDefaultText("default.testmessage2", Locale.getDefault()));
     }
 
     public void testSetSettings() {

http://git-wip-us.apache.org/repos/asf/struts/blob/6e89179e/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java b/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
index 91b0ebf..d8f10cc 100644
--- a/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
+++ b/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
@@ -32,7 +32,7 @@ import com.opensymphony.xwork2.config.entities.InterceptorStackConfig;
 import com.opensymphony.xwork2.config.entities.PackageConfig;
 import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.interceptor.Interceptor;
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
+import com.opensymphony.xwork2.LocalizedTextProvider;
 import org.apache.struts2.StrutsConstants;
 import org.apache.struts2.StrutsInternalTestCase;
 import org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper;
@@ -55,14 +55,14 @@ import java.util.Map;
 public class DispatcherTest extends StrutsInternalTestCase {
 
     public void testDefaultResurceBundlePropertyLoaded() throws Exception {
-        LocalizedTextUtil localizedTextUtil = container.inject(LocalizedTextUtil.class);
+        LocalizedTextProvider localizedTextProvider = container.getInstance(LocalizedTextProvider.class);
 
         // some i18n messages from xwork-messages.properties
-        assertEquals(localizedTextUtil.findDefaultText("xwork.error.action.execution", Locale.US),
+        assertEquals(localizedTextProvider.findDefaultText("xwork.error.action.execution", Locale.US),
                 "Error during Action invocation");
 
         // some i18n messages from struts-messages.properties
-        assertEquals(localizedTextUtil.findDefaultText("struts.messages.error.uploading", Locale.US,
+        assertEquals(localizedTextProvider.findDefaultText("struts.messages.error.uploading", Locale.US,
                         new Object[] { "some error messages" }),
                 "Error uploading: some error messages");
     }

http://git-wip-us.apache.org/repos/asf/struts/blob/6e89179e/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java
----------------------------------------------------------------------
diff --git a/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java b/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java
index 9f70560..42d7e30 100644
--- a/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java
+++ b/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java
@@ -235,7 +235,6 @@ public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics {
         if (StringUtils.isEmpty(portletNamespace)) {
             portletNamespace = "";
         }
-        LocalizedTextUtil.addDefaultResourceBundle("org/apache/struts2/struts-messages");
 
         container = dispatcherUtils.getContainer();
         actionMapper = container.getInstance(ActionMapper.class);


[13/24] struts git commit: Merge branch 'injectable-context' into localized-bean

Posted by lu...@apache.org.
Merge branch 'injectable-context' into localized-bean


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

Branch: refs/heads/master
Commit: d1fbf6a8972908fac3a41ec0e2756fe4eec1afb6
Parents: 6c19875 8852e3d
Author: Lukasz Lenart <lu...@apache.org>
Authored: Mon Mar 13 08:20:42 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Mon Mar 13 08:20:42 2017 +0100

----------------------------------------------------------------------
 .../com/opensymphony/xwork2/ActionSupport.java  |   7 +-
 .../xwork2/TextProviderFactory.java             |  29 ++--
 .../providers/XWorkConfigurationProvider.java   |   4 +
 .../AnnotationActionValidatorManager.java       |   8 +-
 .../DefaultActionValidatorManager.java          |  13 +-
 .../validator/DelegatingValidatorContext.java   |  33 +----
 .../validator/validators/ValidatorSupport.java  |  10 +-
 .../validators/VisitorFieldValidator.java       |  25 +++-
 .../org/apache/struts2/StrutsConstants.java     |   2 +
 .../org/apache/struts2/components/I18n.java     |   5 +-
 .../config/DefaultBeanSelectionProvider.java    |   2 +
 .../interceptor/FileUploadInterceptor.java      |   8 +-
 core/src/main/resources/struts-default.xml      |   1 +
 .../opensymphony/xwork2/ActionSupportTest.java  |   6 +-
 .../validator/ActionValidatorManagerTest.java   |  34 +++--
 .../AnnotationActionValidatorManagerTest.java   |  20 ++-
 .../ConversionErrorFieldValidatorTest.java      |   5 +-
 .../validator/DoubleRangeValidatorTest.java     |  12 +-
 .../xwork2/validator/DummyValidatorContext.java | 144 ++++++++++++++++++
 .../xwork2/validator/EmailValidatorTest.java    |  13 +-
 .../validator/ExpressionValidatorTest.java      |  10 +-
 .../validator/GenericValidatorContext.java      | 146 -------------------
 .../validator/RegexFieldValidatorTest.java      |  20 ++-
 ...onversionErrorFieldValidatorSupportTest.java |  11 +-
 .../validator/SimpleActionValidationTest.java   |   2 +-
 .../StringLengthFieldValidatorTest.java         |   3 +-
 .../xwork2/validator/StringValidatorTest.java   |  21 ++-
 .../xwork2/validator/URLValidatorTest.java      |  15 +-
 .../validator/VisitorFieldValidatorTest.java    |   7 +-
 .../AppendingValidatorContextTest.java          |  25 +++-
 .../validators/DateRangeFieldValidatorTest.java |  12 +-
 .../validators/IntRangeFieldValidatorTest.java  |  16 +-
 .../validators/LongRangeFieldValidatorTest.java |  16 +-
 .../validators/RequiredStringValidatorTest.java |  14 +-
 .../ShortRangeFieldValidatorTest.java           |  16 +-
 .../apache/struts2/views/jsp/TextTagTest.java   |   4 +-
 .../struts2/views/jsp/ui/TooltipTest.java       |   9 +-
 .../com/opensymphony/xwork2/TestBean.properties |   2 +-
 .../interceptor/BeanValidationInterceptor.java  |  10 +-
 .../interceptor/OValValidationInterceptor.java  |  11 +-
 .../struts2/tiles/I18NAttributeEvaluator.java   |   7 +-
 41 files changed, 442 insertions(+), 316 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/d1fbf6a8/core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java
----------------------------------------------------------------------
diff --cc core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java
index de0b963,ff27731..2adab77
--- a/core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java
+++ b/core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java
@@@ -178,9 -178,11 +179,12 @@@ public class XWorkConfigurationProvide
                  .factory(NullHandler.class, Object.class.getName(), InstantiatingNullHandler.class, Scope.SINGLETON)
                  .factory(ActionValidatorManager.class, AnnotationActionValidatorManager.class, Scope.SINGLETON)
                  .factory(ActionValidatorManager.class, "no-annotations", DefaultActionValidatorManager.class, Scope.SINGLETON)
+ 
+                 .factory(TextProviderFactory.class, Scope.SINGLETON)
 +                .factory(LocalizedTextUtil.class, LocalizedTextUtil.class, Scope.SINGLETON)
                  .factory(TextProvider.class, "system", DefaultTextProvider.class, Scope.SINGLETON)
                  .factory(TextProvider.class, TextProviderSupport.class, Scope.SINGLETON)
+ 
                  .factory(LocaleProvider.class, DefaultLocaleProvider.class, Scope.SINGLETON)
                  .factory(OgnlUtil.class, Scope.SINGLETON)
                  .factory(CollectionConverter.class, Scope.SINGLETON)

http://git-wip-us.apache.org/repos/asf/struts/blob/d1fbf6a8/core/src/main/java/com/opensymphony/xwork2/validator/DelegatingValidatorContext.java
----------------------------------------------------------------------
diff --cc core/src/main/java/com/opensymphony/xwork2/validator/DelegatingValidatorContext.java
index e35d7a8,79507bb..90812bd
--- a/core/src/main/java/com/opensymphony/xwork2/validator/DelegatingValidatorContext.java
+++ b/core/src/main/java/com/opensymphony/xwork2/validator/DelegatingValidatorContext.java
@@@ -71,13 -68,10 +68,13 @@@ public class DelegatingValidatorContex
       * the validation context are created based on the class.
       *
       * @param clazz the class to initialize the context with.
 +     *
 +     * @deprecated will be removed, do not use!
       */
 +    @Deprecated
      public DelegatingValidatorContext(Class clazz) {
          localeProvider = new ActionContextLocaleProvider();
-         textProvider = new TextProviderFactory().createInstance(clazz, localeProvider);
+         textProvider = new TextProviderFactory().createInstance(clazz);
          validationAware = new LoggingValidationAware(clazz);
      }
  

http://git-wip-us.apache.org/repos/asf/struts/blob/d1fbf6a8/core/src/main/java/org/apache/struts2/StrutsConstants.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/struts2/StrutsConstants.java
index 99eb18e,7ae2a5f..3d898ce
--- a/core/src/main/java/org/apache/struts2/StrutsConstants.java
+++ b/core/src/main/java/org/apache/struts2/StrutsConstants.java
@@@ -307,5 -307,5 +307,7 @@@ public final class StrutsConstants 
  
      public static final String STRUTS_SMI_METHOD_REGEX = "struts.strictMethodInvocation.methodRegex";
  
+     public static final String STRUTS_TEXT_PROVIDER_FACTORY = "struts.textProviderFactory";
++
 +    public static final String STRUTS_LOCALIZED_TEXT_PROVIDER = "struts.localizedTextProvider";
  }

http://git-wip-us.apache.org/repos/asf/struts/blob/d1fbf6a8/core/src/main/java/org/apache/struts2/components/I18n.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/struts/blob/d1fbf6a8/core/src/main/java/org/apache/struts2/config/DefaultBeanSelectionProvider.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/struts2/config/DefaultBeanSelectionProvider.java
index b417333,7835185..d048f5f
--- a/core/src/main/java/org/apache/struts2/config/DefaultBeanSelectionProvider.java
+++ b/core/src/main/java/org/apache/struts2/config/DefaultBeanSelectionProvider.java
@@@ -387,9 -388,9 +388,10 @@@ public class DefaultBeanSelectionProvid
          alias(TypeConverterHolder.class, StrutsConstants.STRUTS_CONVERTER_HOLDER, builder, props);
  
          alias(TextProvider.class, StrutsConstants.STRUTS_XWORKTEXTPROVIDER, builder, props, Scope.PROTOTYPE);
+         alias(TextProviderFactory.class, StrutsConstants.STRUTS_TEXT_PROVIDER_FACTORY, builder, props, Scope.PROTOTYPE);
 -
          alias(LocaleProvider.class, StrutsConstants.STRUTS_LOCALE_PROVIDER, builder, props);
 +        alias(LocalizedTextUtil.class, StrutsConstants.STRUTS_LOCALIZED_TEXT_PROVIDER, builder, props);
 +
          alias(ActionProxyFactory.class, StrutsConstants.STRUTS_ACTIONPROXYFACTORY, builder, props);
          alias(ObjectTypeDeterminer.class, StrutsConstants.STRUTS_OBJECTTYPEDETERMINER, builder, props);
          alias(ActionMapper.class, StrutsConstants.STRUTS_MAPPER_CLASS, builder, props);

http://git-wip-us.apache.org/repos/asf/struts/blob/d1fbf6a8/core/src/main/resources/struts-default.xml
----------------------------------------------------------------------
diff --cc core/src/main/resources/struts-default.xml
index d8e80f1,a870c4c..0efdfba
--- a/core/src/main/resources/struts-default.xml
+++ b/core/src/main/resources/struts-default.xml
@@@ -130,7 -130,7 +130,8 @@@
      <bean type="com.opensymphony.xwork2.conversion.impl.NumberConverter" name="struts" class="com.opensymphony.xwork2.conversion.impl.NumberConverter" scope="singleton"/>
      <bean type="com.opensymphony.xwork2.conversion.impl.StringConverter" name="struts" class="com.opensymphony.xwork2.conversion.impl.StringConverter" scope="singleton"/>
  
+     <bean type="com.opensymphony.xwork2.TextProviderFactory" name="struts" class="com.opensymphony.xwork2.TextProviderFactory" scope="prototype" />
 +    <bean type="com.opensymphony.xwork2.util.LocalizedTextUtil" name="struts" class="com.opensymphony.xwork2.util.LocalizedTextUtil" scope="singleton" />
      <bean type="com.opensymphony.xwork2.TextProvider" name="struts" class="com.opensymphony.xwork2.TextProviderSupport" scope="prototype" />
      <bean type="com.opensymphony.xwork2.LocaleProvider" name="struts" class="com.opensymphony.xwork2.DefaultLocaleProvider" scope="singleton" />
  

http://git-wip-us.apache.org/repos/asf/struts/blob/d1fbf6a8/core/src/test/java/com/opensymphony/xwork2/validator/DummyValidatorContext.java
----------------------------------------------------------------------
diff --cc core/src/test/java/com/opensymphony/xwork2/validator/DummyValidatorContext.java
index 0000000,9d3400f..e0f5f33
mode 000000,100644..100644
--- a/core/src/test/java/com/opensymphony/xwork2/validator/DummyValidatorContext.java
+++ b/core/src/test/java/com/opensymphony/xwork2/validator/DummyValidatorContext.java
@@@ -1,0 -1,145 +1,144 @@@
+ /*
+  * Copyright 2002-2003,2009 The Apache Software Foundation.
+  * 
+  * Licensed under the Apache License, Version 2.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  * 
+  *      http://www.apache.org/licenses/LICENSE-2.0
+  * 
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+ package com.opensymphony.xwork2.validator;
+ 
+ import com.opensymphony.xwork2.TextProviderFactory;
+ 
+ import java.util.*;
+ 
+ 
+ /**
+  * Dummy validator context to use to capture error messages.
+  *
+  * @author Mark Woon
+  * @author Matthew Payne
+  */
+ public class DummyValidatorContext extends DelegatingValidatorContext {
+ 
+     private Collection<String> actionErrors;
+     private Collection<String> actionMessages;
+     private Map<String, List<String>> fieldErrors;
+ 
+ 
+     public DummyValidatorContext(Object object, TextProviderFactory tpf) {
+         super(object, tpf);
+     }
+ 
 -
+     @Override
+     public synchronized void setActionErrors(Collection<String> errorMessages) {
+         this.actionErrors = errorMessages;
+     }
+ 
+     @Override
+     public synchronized Collection<String> getActionErrors() {
+         return new ArrayList<>(internalGetActionErrors());
+     }
+ 
+     @Override
+     public synchronized void setActionMessages(Collection<String> messages) {
+         this.actionMessages = messages;
+     }
+ 
+     @Override
+     public synchronized Collection<String> getActionMessages() {
+         return new ArrayList<String>(internalGetActionMessages());
+     }
+ 
+     @Override
+     public synchronized void setFieldErrors(Map<String, List<String>> errorMap) {
+         this.fieldErrors = errorMap;
+     }
+ 
+     /**
+      * Get the field specific errors.
+      *
+      * @return an unmodifiable Map with errors mapped from fieldname (String) to Collection of String error messages
+      */
+     @Override
+     public synchronized Map<String, List<String>> getFieldErrors() {
+         return new HashMap<String, List<String>>(internalGetFieldErrors());
+     }
+ 
+     @Override
+     public synchronized void addActionError(String anErrorMessage) {
+         internalGetActionErrors().add(anErrorMessage);
+     }
+ 
+     /**
+      * Add an Action level message to this Action
+      */
+     @Override
+     public void addActionMessage(String aMessage) {
+         internalGetActionMessages().add(aMessage);
+     }
+ 
+     @Override
+     public synchronized void addFieldError(String fieldName, String errorMessage) {
+         final Map<String, List<String>> errors = internalGetFieldErrors();
+         List<String> thisFieldErrors = errors.get(fieldName);
+ 
+         if (thisFieldErrors == null) {
+             thisFieldErrors = new ArrayList<>();
+             errors.put(fieldName, thisFieldErrors);
+         }
+ 
+         thisFieldErrors.add(errorMessage);
+     }
+ 
+     @Override
+     public synchronized boolean hasActionErrors() {
+         return (actionErrors != null) && !actionErrors.isEmpty();
+     }
+ 
+     /**
+      * Note that this does not have the same meaning as in WW 1.x
+      *
+      * @return (hasActionErrors() || hasFieldErrors())
+      */
+     @Override
+     public synchronized boolean hasErrors() {
+         return (hasActionErrors() || hasFieldErrors());
+     }
+ 
+     @Override
+     public synchronized boolean hasFieldErrors() {
+         return (fieldErrors != null) && !fieldErrors.isEmpty();
+     }
+ 
+     private Collection<String> internalGetActionErrors() {
+         if (actionErrors == null) {
+             actionErrors = new ArrayList<>();
+         }
+ 
+         return actionErrors;
+     }
+ 
+     private Collection<String> internalGetActionMessages() {
+         if (actionMessages == null) {
+             actionMessages = new ArrayList<>();
+         }
+ 
+         return actionMessages;
+     }
+ 
+     private Map<String, List<String>> internalGetFieldErrors() {
+         if (fieldErrors == null) {
+             fieldErrors = new HashMap<>();
+         }
+ 
+         return fieldErrors;
+     }
+ }


[23/24] struts git commit: Adds info about new extension point

Posted by lu...@apache.org.
Adds info about new extension point


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

Branch: refs/heads/master
Commit: fefb91fe118bc4518196c4086a63960558454ed5
Parents: 3a84a62
Author: Lukasz Lenart <lu...@apache.org>
Authored: Tue Mar 14 10:11:23 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Tue Mar 14 10:11:23 2017 +0100

----------------------------------------------------------------------
 .../apache/struts2/config/DefaultBeanSelectionProvider.java    | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/fefb91fe/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 6e5bf8b..a89ae9a 100644
--- a/core/src/main/java/org/apache/struts2/config/DefaultBeanSelectionProvider.java
+++ b/core/src/main/java/org/apache/struts2/config/DefaultBeanSelectionProvider.java
@@ -333,6 +333,12 @@ import org.apache.struts2.views.velocity.VelocityManager;
  *     <td>singleton</td>
  *     <td>Matches content type of uploaded files (since 2.3.22)</td>
  *   </tr>
+ *   <tr>
+ *     <td>com.opensymphony.xwork2.LocalizedTextProvider</td>
+ *     <td>struts.localizedTextProvider</td>
+ *     <td>singleton</td>
+ *     <td>Provides access to resource bundles used to localise messages (since 2.5.11)</td>
+ *   </tr>
  * </table>
  *
  * <!-- END SNIPPET: extensionPoints -->


[14/24] struts git commit: Makes class serializable

Posted by lu...@apache.org.
Makes class serializable


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

Branch: refs/heads/master
Commit: f1a963b323d0dfe434742c7a049fe0966a659861
Parents: d1fbf6a
Author: Lukasz Lenart <lu...@apache.org>
Authored: Mon Mar 13 09:09:45 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Mon Mar 13 09:09:45 2017 +0100

----------------------------------------------------------------------
 .../main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/f1a963b3/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java b/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
index 1334cad..7e870fd 100644
--- a/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
+++ b/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
@@ -33,6 +33,7 @@ import org.apache.logging.log4j.Logger;
 import org.apache.struts2.StrutsConstants;
 
 import java.beans.PropertyDescriptor;
+import java.io.Serializable;
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -87,7 +88,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
  * @author Rainer Hermanns
  * @author tm_jee
  */
-public class LocalizedTextUtil {
+public class LocalizedTextUtil implements Serializable {
 
     private static final Logger LOG = LogManager.getLogger(LocalizedTextUtil.class);
 


[15/24] struts git commit: Extends constructors to inject LocalizedTextUtil

Posted by lu...@apache.org.
Extends constructors to inject LocalizedTextUtil


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

Branch: refs/heads/master
Commit: ca0f62925ab6338823f454799f521208ed0dd6e7
Parents: f1a963b
Author: Lukasz Lenart <lu...@apache.org>
Authored: Mon Mar 13 09:10:19 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Mon Mar 13 09:10:19 2017 +0100

----------------------------------------------------------------------
 .../com/opensymphony/xwork2/TextProviderFactory.java     | 11 +++++++++--
 .../com/opensymphony/xwork2/TextProviderSupport.java     |  6 ++++--
 2 files changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/ca0f6292/core/src/main/java/com/opensymphony/xwork2/TextProviderFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/TextProviderFactory.java b/core/src/main/java/com/opensymphony/xwork2/TextProviderFactory.java
index b00f451..43c6792 100644
--- a/core/src/main/java/com/opensymphony/xwork2/TextProviderFactory.java
+++ b/core/src/main/java/com/opensymphony/xwork2/TextProviderFactory.java
@@ -16,6 +16,7 @@
 package com.opensymphony.xwork2;
 
 import com.opensymphony.xwork2.inject.Inject;
+import com.opensymphony.xwork2.util.LocalizedTextUtil;
 
 import java.util.ResourceBundle;
 
@@ -29,6 +30,7 @@ public class TextProviderFactory {
 
     private TextProvider textProvider;
     private LocaleProvider localeProvider;
+    private LocalizedTextUtil localizedTextUtil;
 
     @Inject
     public void setTextProvider(TextProvider textProvider) {
@@ -40,6 +42,11 @@ public class TextProviderFactory {
         this.localeProvider = localeProvider;
     }
 
+    @Inject
+    public void setLocalizedTextUtil(LocalizedTextUtil localizedTextUtil) {
+        this.localizedTextUtil = localizedTextUtil;
+    }
+
     public TextProvider createInstance(Class clazz) {
         TextProvider instance = getTextProvider(clazz);
         if (instance instanceof ResourceBundleTextProvider) {
@@ -60,7 +67,7 @@ public class TextProviderFactory {
 
     protected TextProvider getTextProvider(Class clazz) {
         if (this.textProvider == null) {
-            return new TextProviderSupport(clazz, localeProvider);
+            return new TextProviderSupport(clazz, localeProvider, localizedTextUtil);
         } else {
             return textProvider;
         }
@@ -68,7 +75,7 @@ public class TextProviderFactory {
 
     private TextProvider getTextProvider(ResourceBundle bundle) {
         if (this.textProvider == null) {
-            textProvider = new TextProviderSupport(bundle, localeProvider);
+            return new TextProviderSupport(bundle, localeProvider, localizedTextUtil);
         }
         return textProvider;
     }

http://git-wip-us.apache.org/repos/asf/struts/blob/ca0f6292/core/src/main/java/com/opensymphony/xwork2/TextProviderSupport.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/TextProviderSupport.java b/core/src/main/java/com/opensymphony/xwork2/TextProviderSupport.java
index ab37e92..98dd3d2 100644
--- a/core/src/main/java/com/opensymphony/xwork2/TextProviderSupport.java
+++ b/core/src/main/java/com/opensymphony/xwork2/TextProviderSupport.java
@@ -47,9 +47,10 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
      * @param clazz    a clazz to use for reading the resource bundle.
      * @param provider a locale provider.
      */
-    public TextProviderSupport(Class clazz, LocaleProvider provider) {
+    public TextProviderSupport(Class clazz, LocaleProvider provider, LocalizedTextUtil localizedTextUtil) {
         this.clazz = clazz;
         this.localeProvider = provider;
+        this.localizedTextUtil = localizedTextUtil;
     }
 
     /**
@@ -58,9 +59,10 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
      * @param bundle   the resource bundle.
      * @param provider a locale provider.
      */
-    public TextProviderSupport(ResourceBundle bundle, LocaleProvider provider) {
+    public TextProviderSupport(ResourceBundle bundle, LocaleProvider provider, LocalizedTextUtil localizedTextUtil) {
         this.bundle = bundle;
         this.localeProvider = provider;
+        this.localizedTextUtil = localizedTextUtil;
     }
 
     /**


[08/24] struts git commit: Marks param as a deprecated

Posted by lu...@apache.org.
Marks param as a deprecated


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

Branch: refs/heads/master
Commit: 741f3fa107eee331209e52477c1a007bfc5db755
Parents: 524343c
Author: Lukasz Lenart <lu...@apache.org>
Authored: Wed Mar 8 17:52:01 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Wed Mar 8 17:52:01 2017 +0100

----------------------------------------------------------------------
 .../apache/struts2/config/StrutsXmlConfigurationProvider.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/741f3fa1/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java b/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java
index e39e475..75b8f64 100644
--- a/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java
+++ b/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java
@@ -62,10 +62,10 @@ public class StrutsXmlConfigurationProvider extends XmlConfigurationProvider {
      * Constructs the configuration provider
      *
      * @param filename The filename to look for
-     * @param errorIfMissing If we should throw an exception if the file can't be found
+     * @param errorIfMissing If we should throw an exception if the file can't be found, @deprecated and should be dropped
      * @param ctx Our ServletContext
      */
-    public StrutsXmlConfigurationProvider(String filename, boolean errorIfMissing, ServletContext ctx) {
+    public StrutsXmlConfigurationProvider(String filename, @Deprecated boolean errorIfMissing, ServletContext ctx) {
         super(filename, errorIfMissing);
         this.servletContext = ctx;
         this.filename = filename;


[20/24] struts git commit: Renames LocalizedTextUtil into DefaultLocalizedTextProvider

Posted by lu...@apache.org.
http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java b/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
deleted file mode 100644
index 8fb9e00..0000000
--- a/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
+++ /dev/null
@@ -1,1035 +0,0 @@
-/*
- * $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.opensymphony.xwork2.util;
-
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.LocalizedTextProvider;
-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.commons.lang3.ObjectUtils;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.apache.struts2.StrutsConstants;
-
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.text.MessageFormat;
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-
-/**
- * Provides support for localization in XWork.
- *
- * <!-- START SNIPPET: searchorder -->
- * <p>Resource bundles are searched in the following order:</p>
- *
- * <ol>
- * <li>ActionClass.properties</li>
- * <li>Interface.properties (every interface and sub-interface)</li>
- * <li>BaseClass.properties (all the way to Object.properties)</li>
- * <li>ModelDriven's model (if implements ModelDriven), for the model object repeat from 1</li>
- * <li>package.properties (of the directory where class is located and every parent directory all the way to the root directory)</li>
- * <li>search up the i18n message key hierarchy itself</li>
- * <li>global resource properties</li>
- * </ol>
- *
- * <!-- END SNIPPET: searchorder -->
- *
- * <!-- START SNIPPET: packagenote -->
- * <p>To clarify #5, while traversing the package hierarchy, Struts 2 will look for a file package.properties:</p>
- * com/<br>
- * &nbsp; acme/<br>
- * &nbsp; &nbsp; package.properties<br>
- * &nbsp; &nbsp; actions/<br>
- * &nbsp; &nbsp; &nbsp; package.properties<br>
- * &nbsp; &nbsp; &nbsp; FooAction.java<br>
- * &nbsp; &nbsp; &nbsp; FooAction.properties<br>
- * <p>
- * If FooAction.properties does not exist, com/acme/action/package.properties will be searched for, if
- * not found com/acme/package.properties, if not found com/package.properties, etc.
- * </p>
- * <!-- END SNIPPET: packagenote -->
- *
- * <!-- START SNIPPET: globalresource -->
- * <p>
- * A global resource bundle could be specified programmatically, as well as the locale.
- * </p>
- * <!-- END SNIPPET: globalresource -->
- *
- * @author Jason Carreira
- * @author Mark Woon
- * @author Rainer Hermanns
- * @author tm_jee
- */
-public class LocalizedTextUtil implements LocalizedTextProvider {
-
-    private static final Logger LOG = LogManager.getLogger(LocalizedTextUtil.class);
-
-    private static final String TOMCAT_RESOURCE_ENTRIES_FIELD = "resourceEntries";
-
-    private final ConcurrentMap<Integer, List<String>> classLoaderMap = new ConcurrentHashMap<>();
-
-    private boolean reloadBundles = false;
-    private boolean devMode = false;
-
-    private final ConcurrentMap<String, ResourceBundle> bundlesMap = new ConcurrentHashMap<>();
-    private final ConcurrentMap<MessageFormatKey, MessageFormat> messageFormats = new ConcurrentHashMap<>();
-    private final ConcurrentMap<Integer, ClassLoader> delegatedClassLoaderMap = new ConcurrentHashMap<>();
-    private final Set<String> missingBundles = Collections.synchronizedSet(new HashSet<String>());
-
-    private final String RELOADED = "com.opensymphony.xwork2.util.LocalizedTextUtil.reloaded";
-    private final String XWORK_MESSAGES_BUNDLE = "com/opensymphony/xwork2/xwork-messages";
-
-    /**
-     * Clears the internal list of resource bundles.
-     *
-     * @deprecated used only in tests
-     */
-    @Deprecated
-    public static void clearDefaultResourceBundles() {
-        // no-op
-    }
-
-    public LocalizedTextUtil() {
-        addDefaultResourceBundle("org/apache/struts2/struts-messages");
-    }
-
-    /**
-     * Should resorce bundles be reloaded.
-     *
-     * @param reloadBundles reload bundles?
-     */
-    @Inject(value = StrutsConstants.STRUTS_I18N_RELOAD, required = false)
-    public void setReloadBundles(String reloadBundles) {
-        this.reloadBundles = Boolean.parseBoolean(reloadBundles);
-    }
-
-    @Inject(value = StrutsConstants.STRUTS_DEVMODE, required = false)
-    public void setDevMode(String devMode) {
-        this.devMode = Boolean.parseBoolean(devMode);
-    }
-
-    @Inject(value = StrutsConstants.STRUTS_CUSTOM_I18N_RESOURCES, required = false)
-    public void setCustomI18NBundles(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("Could not find messages file {}.properties. Skipping", name);
-                }
-            }
-        }
-    }
-
-    /**
-     * Add's the bundle to the internal list of default bundles.
-     * <p>
-     * If the bundle already exists in the list it will be readded.
-     * </p>
-     *
-     * @param resourceBundleName the name of the bundle to add.
-     */
-    @Override
-    public void addDefaultResourceBundle(String resourceBundleName) {
-        //make sure this doesn't get added more than once
-        final ClassLoader ccl = getCurrentThreadContextClassLoader();
-        synchronized (XWORK_MESSAGES_BUNDLE) {
-            List<String> bundles = classLoaderMap.get(ccl.hashCode());
-            if (bundles == null) {
-                bundles = new CopyOnWriteArrayList<>();
-                bundles.add(XWORK_MESSAGES_BUNDLE);
-                classLoaderMap.put(ccl.hashCode(), bundles);
-            }
-            bundles.remove(resourceBundleName);
-            bundles.add(0, resourceBundleName);
-        }
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Added default resource bundle '{}' to default resource bundles for the following classloader '{}'", resourceBundleName, ccl.toString());
-        }
-    }
-
-    /**
-     * 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
-     * {@link java.util.Locale#toString()}.
-     *
-     * @param localeStr     The locale String to parse.
-     * @param defaultLocale The locale to use if localeStr is <tt>null</tt>.
-     * @return requested Locale
-     */
-    public static Locale localeFromString(String localeStr, Locale defaultLocale) {
-        if ((localeStr == null) || (localeStr.trim().length() == 0) || ("_".equals(localeStr))) {
-            if (defaultLocale != null) {
-                return defaultLocale;
-            }
-            return Locale.getDefault();
-        }
-
-        int index = localeStr.indexOf('_');
-        if (index < 0) {
-            return new Locale(localeStr);
-        }
-
-        String language = localeStr.substring(0, index);
-        if (index == localeStr.length()) {
-            return new Locale(language);
-        }
-
-        localeStr = localeStr.substring(index + 1);
-        index = localeStr.indexOf('_');
-        if (index < 0) {
-            return new Locale(language, localeStr);
-        }
-
-        String country = localeStr.substring(0, index);
-        if (index == localeStr.length()) {
-            return new Locale(language, country);
-        }
-
-        localeStr = localeStr.substring(index + 1);
-        return new Locale(language, country, localeStr);
-    }
-
-    /**
-     * Returns a localized message for the specified key, aTextName.  Neither the key nor the
-     * message is evaluated.
-     *
-     * @param aTextName the message key
-     * @param locale    the locale the message should be for
-     * @return a localized message based on the specified key, or null if no localized message can be found for it
-     */
-    @Override
-    public String findDefaultText(String aTextName, Locale locale) {
-        List<String> localList = classLoaderMap.get(Thread.currentThread().getContextClassLoader().hashCode());
-
-        for (String bundleName : localList) {
-            ResourceBundle bundle = findResourceBundle(bundleName, locale);
-            if (bundle != null) {
-                reloadBundles();
-                try {
-                    return bundle.getString(aTextName);
-                } catch (MissingResourceException e) {
-                	// will be logged when not found in any bundle
-                }
-            }
-        }
-
-        if (devMode) {
-            LOG.warn("Missing key [{}] in bundles [{}]!", aTextName, localList);
-        } else {
-            LOG.debug("Missing key [{}] in bundles [{}]!", aTextName, localList);
-        }
-
-        return null;
-    }
-
-    /**
-     * Returns a localized message for the specified key, aTextName, substituting variables from the
-     * array of params into the message.  Neither the key nor the message is evaluated.
-     *
-     * @param aTextName the message key
-     * @param locale    the locale the message should be for
-     * @param params    an array of objects to be substituted into the message text
-     * @return A formatted message based on the specified key, or null if no localized message can be found for it
-     */
-    @Override
-    public String findDefaultText(String aTextName, Locale locale, Object[] params) {
-        String defaultText = findDefaultText(aTextName, locale);
-        if (defaultText != null) {
-            MessageFormat mf = buildMessageFormat(defaultText, locale);
-            return formatWithNullDetection(mf, params);
-        }
-        return null;
-    }
-
-    /**
-     * Finds the given resource bundle by it's name.
-     * <p>
-     * Will use <code>Thread.currentThread().getContextClassLoader()</code> as the classloader.
-     * </p>
-     *
-     * @param aBundleName the name of the bundle (usually it's FQN classname).
-     * @param locale      the locale.
-     * @return the bundle, <tt>null</tt> if not found.
-     */
-    @Override
-    public ResourceBundle findResourceBundle(String aBundleName, Locale locale) {
-        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)) {
-                bundle = bundlesMap.get(key);
-            } else {
-                bundle = ResourceBundle.getBundle(aBundleName, locale, classLoader);
-                bundlesMap.putIfAbsent(key, bundle);
-            }
-        } catch (MissingResourceException ex) {
-            if (delegatedClassLoaderMap.containsKey(classLoader.hashCode())) {
-                try {
-                    if (bundlesMap.containsKey(key)) {
-                        bundle = bundlesMap.get(key);
-                    } else {
-                        bundle = ResourceBundle.getBundle(aBundleName, locale, delegatedClassLoaderMap.get(classLoader.hashCode()));
-                        bundlesMap.putIfAbsent(key, bundle);
-                    }
-                } catch (MissingResourceException e) {
-                    LOG.debug("Missing resource bundle [{}]!", aBundleName, e);
-                    missingBundles.add(key);
-                }
-            } else {
-                LOG.debug("Missing resource bundle [{}]!", aBundleName);
-                missingBundles.add(key);
-            }
-        }
-        return bundle;
-    }
-
-    /**
-     * @param classLoader a {@link ClassLoader} to look up the bundle from if none can be found on the current thread's classloader
-     */
-    public void setDelegatedClassLoader(final ClassLoader classLoader) {
-        synchronized (bundlesMap) {
-            delegatedClassLoaderMap.put(getCurrentThreadContextClassLoader().hashCode(), classLoader);
-        }
-    }
-
-    /**
-     * @param bundleName Removes the bundle from any cached "misses"
-     */
-    public void clearBundle(final String bundleName) {
-        bundlesMap.remove(getCurrentThreadContextClassLoader().hashCode() + bundleName);
-    }
-
-
-    /**
-     * Creates a key to used for lookup/storing in the bundle misses cache.
-     *
-     * @param prefix      the prefix for the returning String - it is supposed to be the ClassLoader hash code.
-     * @param aBundleName the name of the bundle (usually it's FQN classname).
-     * @param locale      the locale.
-     * @return the key to use for lookup/storing in the bundle misses cache.
-     */
-    private String createMissesKey(String prefix, String aBundleName, Locale locale) {
-        return prefix + aBundleName + "_" + locale.toString();
-    }
-
-    /**
-     * Calls {@link #findText(Class aClass, String aTextName, Locale locale, String defaultMessage, Object[] args)}
-     * with aTextName as the default message.
-     *
-     * @param aClass class name
-     * @param aTextName  text name
-     * @param locale the locale
-     *
-     * @return the localized text, or null if none can be found and no defaultMessage is provided
-     * @see #findText(Class aClass, String aTextName, Locale locale, String defaultMessage, Object[] args)
-     */
-    @Override
-    public String findText(Class aClass, String aTextName, Locale locale) {
-        return findText(aClass, aTextName, locale, aTextName, new Object[0]);
-    }
-
-    /**
-     * <p>
-     * Finds a localized text message for the given key, aTextName. Both the key and the message
-     * itself is evaluated as required.  The following algorithm is used to find the requested
-     * message:
-     * </p>
-     *
-     * <ol>
-     * <li>Look for message in aClass' class hierarchy.
-     * <ol>
-     * <li>Look for the message in a resource bundle for aClass</li>
-     * <li>If not found, look for the message in a resource bundle for any implemented interface</li>
-     * <li>If not found, traverse up the Class' hierarchy and repeat from the first sub-step</li>
-     * </ol></li>
-     * <li>If not found and aClass is a {@link ModelDriven} Action, then look for message in
-     * the model's class hierarchy (repeat sub-steps listed above).</li>
-     * <li>If not found, look for message in child property.  This is determined by evaluating
-     * the message key as an OGNL expression.  For example, if the key is
-     * <i>user.address.state</i>, then it will attempt to see if "user" can be resolved into an
-     * object.  If so, repeat the entire process fromthe beginning with the object's class as
-     * aClass and "address.state" as the message key.</li>
-     * <li>If not found, look for the message in aClass' package hierarchy.</li>
-     * <li>If still not found, look for the message in the default resource bundles.</li>
-     * <li>Return defaultMessage</li>
-     * </ol>
-     *
-     * <p>
-     * When looking for the message, if the key indexes a collection (e.g. user.phone[0]) and a
-     * message for that specific key cannot be found, the general form will also be looked up
-     * (i.e. user.phone[*]).
-     * </p>
-     *
-     * <p>
-     * If a message is found, it will also be interpolated.  Anything within <code>${...}</code>
-     * will be treated as an OGNL expression and evaluated as such.
-     * </p>
-     *
-     * @param aClass         the class whose name to use as the start point for the search
-     * @param aTextName      the key to find the text message for
-     * @param locale         the locale the message should be for
-     * @param defaultMessage the message to be returned if no text message can be found in any
-     *                       resource bundle
-     * @param args           arguments
-     *                       resource bundle
-     * @return the localized text, or null if none can be found and no defaultMessage is provided
-     */
-    @Override
-    public String findText(Class aClass, String aTextName, Locale locale, String defaultMessage, Object[] args) {
-        ValueStack valueStack = ActionContext.getContext().getValueStack();
-        return findText(aClass, aTextName, locale, defaultMessage, args, valueStack);
-
-    }
-
-    /**
-     * <p>
-     * Finds a localized text message for the given key, aTextName. Both the key and the message
-     * itself is evaluated as required.  The following algorithm is used to find the requested
-     * message:
-     * </p>
-     *
-     * <ol>
-     * <li>Look for message in aClass' class hierarchy.
-     * <ol>
-     * <li>Look for the message in a resource bundle for aClass</li>
-     * <li>If not found, look for the message in a resource bundle for any implemented interface</li>
-     * <li>If not found, traverse up the Class' hierarchy and repeat from the first sub-step</li>
-     * </ol></li>
-     * <li>If not found and aClass is a {@link ModelDriven} Action, then look for message in
-     * the model's class hierarchy (repeat sub-steps listed above).</li>
-     * <li>If not found, look for message in child property.  This is determined by evaluating
-     * the message key as an OGNL expression.  For example, if the key is
-     * <i>user.address.state</i>, then it will attempt to see if "user" can be resolved into an
-     * object.  If so, repeat the entire process fromthe beginning with the object's class as
-     * aClass and "address.state" as the message key.</li>
-     * <li>If not found, look for the message in aClass' package hierarchy.</li>
-     * <li>If still not found, look for the message in the default resource bundles.</li>
-     * <li>Return defaultMessage</li>
-     * </ol>
-     *
-     * <p>
-     * When looking for the message, if the key indexes a collection (e.g. user.phone[0]) and a
-     * message for that specific key cannot be found, the general form will also be looked up
-     * (i.e. user.phone[*]).
-     * </p>
-     *
-     * <p>
-     * If a message is found, it will also be interpolated.  Anything within <code>${...}</code>
-     * will be treated as an OGNL expression and evaluated as such.
-     * </p>
-     *
-     * <p>
-     * If a message is <b>not</b> found a WARN log will be logged.
-     * </p>
-     *
-     * @param aClass         the class whose name to use as the start point for the search
-     * @param aTextName      the key to find the text message for
-     * @param locale         the locale the message should be for
-     * @param defaultMessage the message to be returned if no text message can be found in any
-     *                       resource bundle
-     * @param args           arguments
-     * @param valueStack     the value stack to use to evaluate expressions instead of the
-     *                       one in the ActionContext ThreadLocal
-     * @return the localized text, or null if none can be found and no defaultMessage is provided
-     */
-    @Override
-    public String findText(Class aClass, String aTextName, Locale locale, String defaultMessage, Object[] args,
-                           ValueStack valueStack) {
-        String indexedTextName = null;
-        if (aTextName == null) {
-        	LOG.warn("Trying to find text with null key!");
-            aTextName = "";
-        }
-        // calculate indexedTextName (collection[*]) if applicable
-        if (aTextName.contains("[")) {
-            int i = -1;
-
-            indexedTextName = aTextName;
-
-            while ((i = indexedTextName.indexOf("[", i + 1)) != -1) {
-                int j = indexedTextName.indexOf("]", i);
-                String a = indexedTextName.substring(0, i);
-                String b = indexedTextName.substring(j);
-                indexedTextName = a + "[*" + b;
-            }
-        }
-
-        // search up class hierarchy
-        String msg = findMessage(aClass, aTextName, indexedTextName, locale, args, null, valueStack);
-
-        if (msg != null) {
-            return msg;
-        }
-
-        if (ModelDriven.class.isAssignableFrom(aClass)) {
-            ActionContext context = ActionContext.getContext();
-            // search up model's class hierarchy
-            ActionInvocation actionInvocation = context.getActionInvocation();
-
-            // ActionInvocation may be null if we're being run from a Sitemesh filter, so we won't get model texts if this is null
-            if (actionInvocation != null) {
-                Object action = actionInvocation.getAction();
-                if (action instanceof ModelDriven) {
-                    Object model = ((ModelDriven) action).getModel();
-                    if (model != null) {
-                        msg = findMessage(model.getClass(), aTextName, indexedTextName, locale, args, null, valueStack);
-                        if (msg != null) {
-                            return msg;
-                        }
-                    }
-                }
-            }
-        }
-
-        // nothing still? alright, search the package hierarchy now
-        for (Class clazz = aClass;
-             (clazz != null) && !clazz.equals(Object.class);
-             clazz = clazz.getSuperclass()) {
-
-            String basePackageName = clazz.getName();
-            while (basePackageName.lastIndexOf('.') != -1) {
-                basePackageName = basePackageName.substring(0, basePackageName.lastIndexOf('.'));
-                String packageName = basePackageName + ".package";
-                msg = getMessage(packageName, locale, aTextName, valueStack, args);
-
-                if (msg != null) {
-                    return msg;
-                }
-
-                if (indexedTextName != null) {
-                    msg = getMessage(packageName, locale, indexedTextName, valueStack, args);
-
-                    if (msg != null) {
-                        return msg;
-                    }
-                }
-            }
-        }
-
-        // see if it's a child property
-        int idx = aTextName.indexOf(".");
-
-        if (idx != -1) {
-            String newKey = null;
-            String prop = null;
-
-            if (aTextName.startsWith(XWorkConverter.CONVERSION_ERROR_PROPERTY_PREFIX)) {
-                idx = aTextName.indexOf(".", XWorkConverter.CONVERSION_ERROR_PROPERTY_PREFIX.length());
-
-                if (idx != -1) {
-                    prop = aTextName.substring(XWorkConverter.CONVERSION_ERROR_PROPERTY_PREFIX.length(), idx);
-                    newKey = XWorkConverter.CONVERSION_ERROR_PROPERTY_PREFIX + aTextName.substring(idx + 1);
-                }
-            } else {
-                prop = aTextName.substring(0, idx);
-                newKey = aTextName.substring(idx + 1);
-            }
-
-            if (prop != null) {
-                Object obj = valueStack.findValue(prop);
-                try {
-                    Object actionObj = ReflectionProviderFactory.getInstance().getRealTarget(prop, valueStack.getContext(), valueStack.getRoot());
-                    if (actionObj != null) {
-                        PropertyDescriptor propertyDescriptor = ReflectionProviderFactory.getInstance().getPropertyDescriptor(actionObj.getClass(), prop);
-
-                        if (propertyDescriptor != null) {
-                            Class clazz = propertyDescriptor.getPropertyType();
-
-                            if (clazz != null) {
-                                if (obj != null) {
-                                    valueStack.push(obj);
-                                }
-                                msg = findText(clazz, newKey, locale, null, args);
-                                if (obj != null) {
-                                    valueStack.pop();
-                                }
-                                if (msg != null) {
-                                    return msg;
-                                }
-                            }
-                        }
-                    }
-                } catch (Exception e) {
-                    LOG.debug("unable to find property {}", prop, e);
-                }
-            }
-        }
-
-        // get default
-        GetDefaultMessageReturnArg result;
-        if (indexedTextName == null) {
-            result = getDefaultMessage(aTextName, locale, valueStack, args, defaultMessage);
-        } else {
-            result = getDefaultMessage(aTextName, locale, valueStack, args, null);
-            if (result != null && result.message != null) {
-                return result.message;
-            }
-            result = getDefaultMessage(indexedTextName, locale, valueStack, args, defaultMessage);
-        }
-
-        // could we find the text, if not log a warn
-        if (unableToFindTextForKey(result) && LOG.isDebugEnabled()) {
-            String warn = "Unable to find text for key '" + aTextName + "' ";
-            if (indexedTextName != null) {
-                warn += " or indexed key '" + indexedTextName + "' ";
-            }
-            warn += "in class '" + aClass.getName() + "' and locale '" + locale + "'";
-            LOG.debug(warn);
-        }
-
-        return result != null ? result.message : null;
-    }
-
-    /**
-     * Determines if we found the text in the bundles.
-     *
-     * @param result the result so far
-     * @return <tt>true</tt> if we could <b>not</b> find the text, <tt>false</tt> if the text was found (=success).
-     */
-    private static boolean unableToFindTextForKey(GetDefaultMessageReturnArg result) {
-        if (result == null || result.message == null) {
-            return true;
-        }
-
-        // did we find it in the bundle, then no problem?
-        if (result.foundInBundle) {
-            return false;
-        }
-
-        // not found in bundle
-        return true;
-    }
-
-    /**
-     * <p>
-     * Finds a localized text message for the given key, aTextName, in the specified resource bundle
-     * with aTextName as the default message.
-     * </p>
-     *
-     * <p>
-     * If a message is found, it will also be interpolated.  Anything within <code>${...}</code>
-     * will be treated as an OGNL expression and evaluated as such.
-     * </p>
-     *
-     * @param bundle a resource bundle name
-     * @param aTextName  text name
-     * @param locale the locale
-     *
-     * @return the localized text, or null if none can be found and no defaultMessage is provided
-     * @see #findText(java.util.ResourceBundle, String, java.util.Locale, String, Object[])
-     */
-    @Override
-    public String findText(ResourceBundle bundle, String aTextName, Locale locale) {
-        return findText(bundle, aTextName, locale, aTextName, new Object[0]);
-    }
-
-    /**
-     * <p>
-     * Finds a localized text message for the given key, aTextName, in the specified resource
-     * bundle.
-     * </p>
-     *
-     * <p>
-     * If a message is found, it will also be interpolated.  Anything within <code>${...}</code>
-     * will be treated as an OGNL expression and evaluated as such.
-     * </p>
-     *
-     * <p>
-     * If a message is <b>not</b> found a WARN log will be logged.
-     * </p>
-     *
-     * @param bundle         the bundle
-     * @param aTextName      the key
-     * @param locale         the locale
-     * @param defaultMessage the default message to use if no message was found in the bundle
-     * @param args           arguments for the message formatter.
-     * @return the localized text, or null if none can be found and no defaultMessage is provided
-     */
-    @Override
-    public String findText(ResourceBundle bundle, String aTextName, Locale locale, String defaultMessage, Object[] args) {
-        ValueStack valueStack = ActionContext.getContext().getValueStack();
-        return findText(bundle, aTextName, locale, defaultMessage, args, valueStack);
-    }
-
-    /**
-     * <p>
-     * Finds a localized text message for the given key, aTextName, in the specified resource
-     * bundle.
-     * </p>
-     *
-     * <p>
-     * If a message is found, it will also be interpolated.  Anything within <code>${...}</code>
-     * will be treated as an OGNL expression and evaluated as such.
-     * </p>
-     *
-     * <p>
-     * If a message is <b>not</b> found a WARN log will be logged.
-     * </p>
-     *
-     * @param bundle         the bundle
-     * @param aTextName      the key
-     * @param locale         the locale
-     * @param defaultMessage the default message to use if no message was found in the bundle
-     * @param args           arguments for the message formatter.
-     * @param valueStack     the OGNL value stack.
-     * @return the localized text, or null if none can be found and no defaultMessage is provided
-     */
-    @Override
-    public String findText(ResourceBundle bundle, String aTextName, Locale locale, String defaultMessage, Object[] args,
-                           ValueStack valueStack) {
-        try {
-            reloadBundles(valueStack.getContext());
-
-            String message = TextParseUtil.translateVariables(bundle.getString(aTextName), valueStack);
-            MessageFormat mf = buildMessageFormat(message, locale);
-
-            return formatWithNullDetection(mf, args);
-        } catch (MissingResourceException ex) {
-            if (devMode) {
-                LOG.warn("Missing key [{}] in bundle [{}]!", aTextName, bundle);
-            } else {
-                LOG.debug("Missing key [{}] in bundle [{}]!", aTextName, bundle);
-            }
-        }
-
-        GetDefaultMessageReturnArg result = getDefaultMessage(aTextName, locale, valueStack, args, defaultMessage);
-        if (unableToFindTextForKey(result)) {
-            LOG.warn("Unable to find text for key '{}' in ResourceBundles for locale '{}'", aTextName, locale);
-        }
-        return result != null ? result.message : null;
-    }
-
-    /**
-     * @return the default message.
-     */
-    private GetDefaultMessageReturnArg getDefaultMessage(String key, Locale locale, ValueStack valueStack, Object[] args,
-                                                                String defaultMessage) {
-        GetDefaultMessageReturnArg result = null;
-        boolean found = true;
-
-        if (key != null) {
-            String message = findDefaultText(key, locale);
-
-            if (message == null) {
-                message = defaultMessage;
-                found = false; // not found in bundles
-            }
-
-            // defaultMessage may be null
-            if (message != null) {
-                MessageFormat mf = buildMessageFormat(TextParseUtil.translateVariables(message, valueStack), locale);
-
-                String msg = formatWithNullDetection(mf, args);
-                result = new GetDefaultMessageReturnArg(msg, found);
-            }
-        }
-
-        return result;
-    }
-
-    /**
-     * @return the message from the named resource bundle.
-     */
-    private String getMessage(String bundleName, Locale locale, String key, ValueStack valueStack, Object[] args) {
-        ResourceBundle bundle = findResourceBundle(bundleName, locale);
-        if (bundle == null) {
-            return null;
-        }
-        if (valueStack != null) 
-            reloadBundles(valueStack.getContext());
-        try {
-        	String message = bundle.getString(key);
-        	if (valueStack != null) 
-        		message = TextParseUtil.translateVariables(bundle.getString(key), valueStack);
-            MessageFormat mf = buildMessageFormat(message, locale);
-            return formatWithNullDetection(mf, args);
-        } catch (MissingResourceException e) {
-            if (devMode) {
-                LOG.warn("Missing key [{}] in bundle [{}]!", key, bundleName);
-            } else {
-                LOG.debug("Missing key [{}] in bundle [{}]!", key, bundleName);
-            }
-            return null;
-        }
-    }
-
-    private String formatWithNullDetection(MessageFormat mf, Object[] args) {
-        String message = mf.format(args);
-        if ("null".equals(message)) {
-            return null;
-        } else {
-            return message;
-        }
-    }
-
-    private MessageFormat buildMessageFormat(String pattern, Locale locale) {
-        MessageFormatKey key = new MessageFormatKey(pattern, locale);
-        MessageFormat format = messageFormats.get(key);
-        if (format == null) {
-            format = new MessageFormat(pattern);
-            format.setLocale(locale);
-            format.applyPattern(pattern);
-            messageFormats.put(key, format);
-        }
-
-        return format;
-    }
-
-    /**
-     * Traverse up class hierarchy looking for message.  Looks at class, then implemented interface,
-     * before going up hierarchy.
-     *
-     * @return the message
-     */
-    private String findMessage(Class clazz, String key, String indexedKey, Locale locale, Object[] args, Set<String> checked,
-                                      ValueStack valueStack) {
-        if (checked == null) {
-            checked = new TreeSet<String>();
-        } else if (checked.contains(clazz.getName())) {
-            return null;
-        }
-
-        // look in properties of this class
-        String msg = getMessage(clazz.getName(), locale, key, valueStack, args);
-
-        if (msg != null) {
-            return msg;
-        }
-
-        if (indexedKey != null) {
-            msg = getMessage(clazz.getName(), locale, indexedKey, valueStack, args);
-
-            if (msg != null) {
-                return msg;
-            }
-        }
-
-        // look in properties of implemented interfaces
-        Class[] interfaces = clazz.getInterfaces();
-
-        for (Class anInterface : interfaces) {
-            msg = getMessage(anInterface.getName(), locale, key, valueStack, args);
-
-            if (msg != null) {
-                return msg;
-            }
-
-            if (indexedKey != null) {
-                msg = getMessage(anInterface.getName(), locale, indexedKey, valueStack, args);
-
-                if (msg != null) {
-                    return msg;
-                }
-            }
-        }
-
-        // traverse up hierarchy
-        if (clazz.isInterface()) {
-            interfaces = clazz.getInterfaces();
-
-            for (Class anInterface : interfaces) {
-                msg = findMessage(anInterface, key, indexedKey, locale, args, checked, valueStack);
-
-                if (msg != null) {
-                    return msg;
-                }
-            }
-        } else {
-            if (!clazz.equals(Object.class) && !clazz.isPrimitive()) {
-                return findMessage(clazz.getSuperclass(), key, indexedKey, locale, args, checked, valueStack);
-            }
-        }
-
-        return null;
-    }
-
-    private void reloadBundles() {
-        reloadBundles(ActionContext.getContext() != null ? ActionContext.getContext().getContextMap() : null);
-    }
-
-    private void reloadBundles(Map<String, Object> context) {
-        if (reloadBundles) {
-            try {
-                Boolean reloaded;
-                if (context != null) {
-                    reloaded = (Boolean) ObjectUtils.defaultIfNull(context.get(RELOADED), Boolean.FALSE);
-                }else {
-                    reloaded = Boolean.FALSE;
-                }
-                if (!reloaded) {
-                    bundlesMap.clear();
-                    try {
-                        clearMap(ResourceBundle.class, null, "cacheList");
-                    } catch (NoSuchFieldException e) {
-                        // happens in IBM JVM, that has a different ResourceBundle impl
-                        // it has a 'cache' member
-                        clearMap(ResourceBundle.class, null, "cache");
-                    }
-
-                    // now, for the true and utter hack, if we're running in tomcat, clear
-                    // it's class loader resource cache as well.
-                    clearTomcatCache();
-                    if(context!=null) {
-                        context.put(RELOADED, true);
-                    }
-                    LOG.debug("Resource bundles reloaded");
-                }
-            } catch (Exception e) {
-                LOG.error("Could not reload resource bundles", e);
-            }
-        }
-    }
-
-
-    private static void clearTomcatCache() {
-        ClassLoader loader = getCurrentThreadContextClassLoader();
-        // no need for compilation here.
-        Class cl = loader.getClass();
-
-        try {
-            if ("org.apache.catalina.loader.WebappClassLoader".equals(cl.getName())) {
-                clearMap(cl, loader, TOMCAT_RESOURCE_ENTRIES_FIELD);
-            } else {
-                LOG.debug("Class loader {} is not tomcat loader.", cl.getName());
-            }
-        } catch (NoSuchFieldException nsfe) {
-            if ("org.apache.catalina.loader.WebappClassLoaderBase".equals(cl.getSuperclass().getName())) {
-                LOG.debug("Base class {} doesn't contain '{}' field, trying with parent!", cl.getName(), TOMCAT_RESOURCE_ENTRIES_FIELD, nsfe);
-                try {
-                    clearMap(cl.getSuperclass(), loader, TOMCAT_RESOURCE_ENTRIES_FIELD);
-                } catch (Exception e) {
-                    LOG.warn("Couldn't clear tomcat cache using {}", cl.getSuperclass().getName(), e);
-                }
-            }
-        } catch (Exception e) {
-      	    LOG.warn("Couldn't clear tomcat cache", cl.getName(), e);
-        }
-    }
-
-
-    private static void clearMap(Class cl, Object obj, String name)
-            throws NoSuchFieldException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
-
-        Field field = cl.getDeclaredField(name);
-        field.setAccessible(true);
-
-        Object cache = field.get(obj);
-
-        synchronized (cache) {
-            Class ccl = cache.getClass();
-            Method clearMethod = ccl.getMethod("clear");
-            clearMethod.invoke(cache);
-        }
-    }
-
-    /**
-     * Clears all the internal lists.
-     *
-     * @deprecated used only in tests
-     */
-    @Override
-    @Deprecated
-    public void reset() {
-        // no-op
-    }
-
-    static class MessageFormatKey {
-        String pattern;
-        Locale locale;
-
-        MessageFormatKey(String pattern, Locale locale) {
-            this.pattern = pattern;
-            this.locale = locale;
-        }
-
-        @Override
-        public boolean equals(Object o) {
-            if (this == o) return true;
-            if (!(o instanceof MessageFormatKey)) return false;
-
-            final MessageFormatKey messageFormatKey = (MessageFormatKey) o;
-
-            if (locale != null ? !locale.equals(messageFormatKey.locale) : messageFormatKey.locale != null)
-                return false;
-            if (pattern != null ? !pattern.equals(messageFormatKey.pattern) : messageFormatKey.pattern != null)
-                return false;
-
-            return true;
-        }
-
-        @Override
-        public int hashCode() {
-            int result;
-            result = (pattern != null ? pattern.hashCode() : 0);
-            result = 29 * result + (locale != null ? locale.hashCode() : 0);
-            return result;
-        }
-    }
-
-    private static ClassLoader getCurrentThreadContextClassLoader() {
-        return Thread.currentThread().getContextClassLoader();
-    }
-
-    static class GetDefaultMessageReturnArg {
-        String message;
-        boolean foundInBundle;
-
-        public GetDefaultMessageReturnArg(String message, boolean foundInBundle) {
-            this.message = message;
-            this.foundInBundle = foundInBundle;
-        }
-    }
-
-    private static class EmptyResourceBundle extends ResourceBundle {
-        @Override
-        public Enumeration<String> getKeys() {
-            return null; // dummy
-        }
-
-        @Override
-        protected Object handleGetObject(String key) {
-            return null; // dummy
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/core/src/main/java/org/apache/struts2/components/Date.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/Date.java b/core/src/main/java/org/apache/struts2/components/Date.java
index 46c193d..f1a3c97 100644
--- a/core/src/main/java/org/apache/struts2/components/Date.java
+++ b/core/src/main/java/org/apache/struts2/components/Date.java
@@ -23,7 +23,6 @@ package org.apache.struts2.components;
 
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.TextProvider;
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
 import com.opensymphony.xwork2.util.ValueStack;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;

http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/core/src/main/java/org/apache/struts2/components/I18n.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/I18n.java b/core/src/main/java/org/apache/struts2/components/I18n.java
index 7065c4b..f934a3e 100644
--- a/core/src/main/java/org/apache/struts2/components/I18n.java
+++ b/core/src/main/java/org/apache/struts2/components/I18n.java
@@ -33,7 +33,7 @@ import com.opensymphony.xwork2.TextProvider;
 import com.opensymphony.xwork2.TextProviderFactory;
 import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.inject.Inject;
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
+import com.opensymphony.xwork2.util.DefaultLocalizedTextProvider;
 import com.opensymphony.xwork2.util.ValueStack;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
@@ -121,7 +121,7 @@ public class I18n extends Component {
             ResourceBundle bundle = defaultTextProvider.getTexts(name);
 
             if (bundle == null) {
-                bundle = container.getInstance(LocalizedTextUtil.class).findResourceBundle(name, localeProvider.getLocale());
+                bundle = container.getInstance(DefaultLocalizedTextProvider.class).findResourceBundle(name, localeProvider.getLocale());
             }
 
             if (bundle != null) {

http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/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 b21376e..6e5bf8b 100644
--- a/core/src/main/java/org/apache/struts2/config/DefaultBeanSelectionProvider.java
+++ b/core/src/main/java/org/apache/struts2/config/DefaultBeanSelectionProvider.java
@@ -53,7 +53,6 @@ import com.opensymphony.xwork2.factory.ResultFactory;
 import com.opensymphony.xwork2.factory.ValidatorFactory;
 import com.opensymphony.xwork2.inject.ContainerBuilder;
 import com.opensymphony.xwork2.inject.Scope;
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
 import com.opensymphony.xwork2.util.PatternMatcher;
 import com.opensymphony.xwork2.util.TextParser;
 import com.opensymphony.xwork2.util.ValueStackFactory;
@@ -74,8 +73,6 @@ import org.apache.struts2.views.freemarker.FreemarkerManager;
 import org.apache.struts2.views.util.UrlHelper;
 import org.apache.struts2.views.velocity.VelocityManager;
 
-import java.util.StringTokenizer;
-
 /**
  * Selects the implementations of key framework extension points, using the loaded
  * property constants.  The implementations are selected from the container builder

http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
index 7b28117..047238f 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
@@ -26,14 +26,13 @@ import com.opensymphony.xwork2.config.*;
 import com.opensymphony.xwork2.config.entities.InterceptorMapping;
 import com.opensymphony.xwork2.config.entities.InterceptorStackConfig;
 import com.opensymphony.xwork2.config.entities.PackageConfig;
-import com.opensymphony.xwork2.config.impl.DefaultConfiguration;
 import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
 import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.inject.ContainerBuilder;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.interceptor.Interceptor;
 import com.opensymphony.xwork2.util.ClassLoaderUtil;
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
+import com.opensymphony.xwork2.util.DefaultLocalizedTextProvider;
 import com.opensymphony.xwork2.util.ValueStack;
 import com.opensymphony.xwork2.util.ValueStackFactory;
 import com.opensymphony.xwork2.util.location.LocatableProperties;
@@ -647,7 +646,7 @@ public class Dispatcher {
 
         Locale locale;
         if (defaultLocale != null) {
-            locale = LocalizedTextUtil.localeFromString(defaultLocale, request.getLocale());
+            locale = DefaultLocalizedTextProvider.localeFromString(defaultLocale, request.getLocale());
         } else {
             locale = request.getLocale();
         }
@@ -729,7 +728,7 @@ public class Dispatcher {
 
         Locale locale = null;
         if (defaultLocale != null) {
-            locale = LocalizedTextUtil.localeFromString(defaultLocale, request.getLocale());
+            locale = DefaultLocalizedTextProvider.localeFromString(defaultLocale, request.getLocale());
         }
 
         if (encoding != null) {

http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java b/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
index f12f1b5..e6fab1e 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
@@ -21,7 +21,6 @@
 
 package org.apache.struts2.dispatcher.multipart;
 
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
 import org.apache.commons.fileupload.FileItem;
 import org.apache.commons.fileupload.FileUploadBase;
 import org.apache.commons.fileupload.FileUploadException;

http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java b/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java
index 4f55621..571f5c3 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java
@@ -22,14 +22,12 @@
 package org.apache.struts2.dispatcher.multipart;
 
 import com.opensymphony.xwork2.LocaleProvider;
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.apache.struts2.dispatcher.LocalizedMessage;
 import org.apache.struts2.dispatcher.StrutsRequestWrapper;
 
 import javax.servlet.http.HttpServletRequest;
-import java.io.File;
 import java.io.IOException;
 import java.util.*;
 

http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/core/src/main/java/org/apache/struts2/factory/StrutsActionProxy.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/factory/StrutsActionProxy.java b/core/src/main/java/org/apache/struts2/factory/StrutsActionProxy.java
index 9b8e681..a444953 100644
--- a/core/src/main/java/org/apache/struts2/factory/StrutsActionProxy.java
+++ b/core/src/main/java/org/apache/struts2/factory/StrutsActionProxy.java
@@ -26,7 +26,6 @@ package org.apache.struts2.factory;
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.DefaultActionProxy;
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
 import org.apache.struts2.ServletActionContext;
 
 import java.util.Locale;

http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java
index 9060d69..4b6c8f5 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java
@@ -24,7 +24,7 @@ import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.LocaleProvider;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
+import com.opensymphony.xwork2.util.DefaultLocalizedTextProvider;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.message.ParameterizedMessage;
@@ -163,7 +163,7 @@ public class I18nInterceptor extends AbstractInterceptor {
             } else {
                 String localeStr = requestedLocale.toString();
                 if (localeProvider.isValidLocaleString(localeStr)) {
-                    locale = LocalizedTextUtil.localeFromString(requestedLocale.toString(), null);
+                    locale = DefaultLocalizedTextProvider.localeFromString(requestedLocale.toString(), null);
                 }
             }
             if (locale != null) {

http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/core/src/main/java/org/apache/struts2/util/StrutsTestCaseHelper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/util/StrutsTestCaseHelper.java b/core/src/main/java/org/apache/struts2/util/StrutsTestCaseHelper.java
index f778e4c..9c449f5 100644
--- a/core/src/main/java/org/apache/struts2/util/StrutsTestCaseHelper.java
+++ b/core/src/main/java/org/apache/struts2/util/StrutsTestCaseHelper.java
@@ -23,7 +23,7 @@ package org.apache.struts2.util;
 
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.inject.Container;
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
+import com.opensymphony.xwork2.util.DefaultLocalizedTextProvider;
 import com.opensymphony.xwork2.util.ValueStack;
 import com.opensymphony.xwork2.util.ValueStackFactory;
 import org.apache.struts2.dispatcher.Dispatcher;
@@ -47,7 +47,7 @@ public class StrutsTestCaseHelper {
      * @throws Exception in case of any error
      */
     public static void setUp() throws Exception {
-        LocalizedTextUtil.clearDefaultResourceBundles();
+        DefaultLocalizedTextProvider.clearDefaultResourceBundles();
     }
     
     public static Dispatcher initDispatcher(ServletContext ctx, Map<String,String> params) {

http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/core/src/main/java/org/apache/struts2/util/TokenHelper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/util/TokenHelper.java b/core/src/main/java/org/apache/struts2/util/TokenHelper.java
index a5affaa..28f42f6 100644
--- a/core/src/main/java/org/apache/struts2/util/TokenHelper.java
+++ b/core/src/main/java/org/apache/struts2/util/TokenHelper.java
@@ -23,7 +23,6 @@ package org.apache.struts2.util;
 
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.LocalizedTextProvider;
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.apache.struts2.dispatcher.Parameter;

http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/core/src/main/resources/struts-default.xml
----------------------------------------------------------------------
diff --git a/core/src/main/resources/struts-default.xml b/core/src/main/resources/struts-default.xml
index 4a20ac9..1f516b7 100644
--- a/core/src/main/resources/struts-default.xml
+++ b/core/src/main/resources/struts-default.xml
@@ -131,7 +131,7 @@
     <bean type="com.opensymphony.xwork2.conversion.impl.StringConverter" name="struts" class="com.opensymphony.xwork2.conversion.impl.StringConverter" scope="singleton"/>
 
     <bean type="com.opensymphony.xwork2.TextProviderFactory" name="struts" class="com.opensymphony.xwork2.TextProviderFactory" scope="prototype" />
-    <bean type="com.opensymphony.xwork2.LocalizedTextProvider" name="struts" class="com.opensymphony.xwork2.util.LocalizedTextUtil" scope="singleton" />
+    <bean type="com.opensymphony.xwork2.LocalizedTextProvider" name="struts" class="com.opensymphony.xwork2.util.DefaultLocalizedTextProvider" scope="singleton" />
     <bean type="com.opensymphony.xwork2.TextProvider" name="struts" class="com.opensymphony.xwork2.TextProviderSupport" scope="prototype" />
     <bean type="com.opensymphony.xwork2.LocaleProvider" name="struts" class="com.opensymphony.xwork2.DefaultLocaleProvider" scope="singleton" />
 

http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/core/src/test/java/com/opensymphony/xwork2/TextProviderSupportTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/TextProviderSupportTest.java b/core/src/test/java/com/opensymphony/xwork2/TextProviderSupportTest.java
index c0ea23d..118c419 100644
--- a/core/src/test/java/com/opensymphony/xwork2/TextProviderSupportTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/TextProviderSupportTest.java
@@ -16,8 +16,6 @@
 
 package com.opensymphony.xwork2;
 
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
-
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;

http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/core/src/test/java/com/opensymphony/xwork2/util/DefaultLocalizedTextProviderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/util/DefaultLocalizedTextProviderTest.java b/core/src/test/java/com/opensymphony/xwork2/util/DefaultLocalizedTextProviderTest.java
new file mode 100644
index 0000000..a9dca08
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/util/DefaultLocalizedTextProviderTest.java
@@ -0,0 +1,267 @@
+/*
+ * Copyright 2002-2006,2009 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.opensymphony.xwork2.util;
+
+import com.mockobjects.dynamic.Mock;
+import com.opensymphony.xwork2.*;
+import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
+import com.opensymphony.xwork2.test.ModelDrivenAction2;
+import com.opensymphony.xwork2.test.TestBean2;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+
+/**
+ * Unit test for {@link DefaultLocalizedTextProvider}.
+ *
+ * @author jcarreira
+ * @author tm_jee
+ * 
+ * @version $Date$ $Id$
+ */
+public class DefaultLocalizedTextProviderTest extends XWorkTestCase {
+
+    private LocalizedTextProvider localizedTextProvider;
+    
+	public void testNpeWhenClassIsPrimitive() throws Exception {
+		ValueStack stack = ActionContext.getContext().getValueStack();
+		stack.push(new MyObject());
+		String result = localizedTextProvider.findText(MyObject.class, "someObj.someI18nKey", Locale.ENGLISH, "default message", null, stack);
+		System.out.println(result);
+	}
+	
+	public static class MyObject extends ActionSupport {
+		public boolean getSomeObj() {
+			return true;
+		}
+	}
+	
+	public void testActionGetTextWithNullObject() throws Exception {
+		MyAction action = new MyAction();
+        container.inject(action);
+		
+		Mock mockActionInvocation = new Mock(ActionInvocation.class);
+        mockActionInvocation.expectAndReturn("getAction", action);
+        ActionContext.getContext().setActionInvocation((ActionInvocation) mockActionInvocation.proxy());
+		ActionContext.getContext().getValueStack().push(action);
+		
+		String message = action.getText("barObj.title");
+		assertEquals("Title:", message);
+	}
+	
+	
+	public static class MyAction extends ActionSupport {
+		private Bar testBean2;
+		
+		public Bar getBarObj() {
+			return testBean2;
+		}
+		public void setBarObj(Bar testBean2) {
+			this.testBean2 = testBean2;
+		}
+	}
+	
+    public void testActionGetText() throws Exception {
+        ModelDrivenAction2 action = new ModelDrivenAction2();
+        container.inject(action);
+
+        TestBean2 bean = (TestBean2) action.getModel();
+        Bar bar = new Bar();
+        bean.setBarObj(bar);
+
+        Mock mockActionInvocation = new Mock(ActionInvocation.class);
+        mockActionInvocation.expectAndReturn("getAction", action);
+        ActionContext.getContext().setActionInvocation((ActionInvocation) mockActionInvocation.proxy());
+        ActionContext.getContext().getValueStack().push(action);
+        ActionContext.getContext().getValueStack().push(action.getModel());
+
+        String message = action.getText("barObj.title");
+        assertEquals("Title:", message);
+    }
+
+    public void testNullKeys() {
+        localizedTextProvider.findText(this.getClass(), null, Locale.getDefault());
+    }
+
+    public void testActionGetTextXXX() throws Exception {
+        localizedTextProvider.addDefaultResourceBundle("com/opensymphony/xwork2/util/FindMe");
+
+        SimpleAction action = new SimpleAction();
+        container.inject(action);
+
+        Mock mockActionInvocation = new Mock(ActionInvocation.class);
+        mockActionInvocation.expectAndReturn("getAction", action);
+        ActionContext.getContext().setActionInvocation((ActionInvocation) mockActionInvocation.proxy());
+        ActionContext.getContext().getValueStack().push(action);
+
+        String message = action.getText("bean.name");
+        String foundBean2 = action.getText("bean2.name");
+
+        assertEquals("Okay! You found Me!", foundBean2);
+        assertEquals("Haha you cant FindMe!", message);
+    }
+
+    public void testAddDefaultResourceBundle() {
+        String text = localizedTextProvider.findDefaultText("foo.range", Locale.getDefault());
+        assertNull("Found message when it should not be available.", text);
+
+        localizedTextProvider.addDefaultResourceBundle("com/opensymphony/xwork2/SimpleAction");
+
+        String message = localizedTextProvider.findDefaultText("foo.range", Locale.US);
+        assertEquals("Foo Range Message", message);
+    }
+
+    public void testAddDefaultResourceBundle2() throws Exception {
+        localizedTextProvider.addDefaultResourceBundle("com/opensymphony/xwork2/SimpleAction");
+
+        ActionProxy proxy = actionProxyFactory.createActionProxy("/", "packagelessAction", null, new HashMap<String, Object>(), false, true);
+        proxy.execute();
+    }
+
+    public void testDefaultMessage() throws Exception {
+        String message = localizedTextProvider.findDefaultText("xwork.error.action.execution", Locale.getDefault());
+        assertEquals("Error during Action invocation", message);
+    }
+
+    public void testDefaultMessageOverride() throws Exception {
+        String message = localizedTextProvider.findDefaultText("xwork.error.action.execution", Locale.getDefault());
+        assertEquals("Error during Action invocation", message);
+
+        localizedTextProvider.addDefaultResourceBundle("com/opensymphony/xwork2/test");
+
+        message = localizedTextProvider.findDefaultText("xwork.error.action.execution", Locale.getDefault());
+        assertEquals("Testing resource bundle override", message);
+    }
+
+    public void testFindTextInChildProperty() throws Exception {
+        ModelDriven action = new ModelDrivenAction2();
+        TestBean2 bean = (TestBean2) action.getModel();
+        Bar bar = new Bar();
+        bean.setBarObj(bar);
+
+        Mock mockActionInvocation = new Mock(ActionInvocation.class);
+        mockActionInvocation.expectAndReturn("hashCode", 0);
+        mockActionInvocation.expectAndReturn("getAction", action);
+        ActionContext.getContext().setActionInvocation((ActionInvocation) mockActionInvocation.proxy());
+        ActionContext.getContext().getValueStack().push(action);
+        ActionContext.getContext().getValueStack().push(action.getModel());
+
+        String message = localizedTextProvider.findText(ModelDrivenAction2.class, "invalid.fieldvalue.barObj.title", Locale.getDefault());
+        assertEquals("Title is invalid!", message);
+    }
+
+    public void testFindTextInInterface() throws Exception {
+        Action action = new ModelDrivenAction2();
+        Mock mockActionInvocation = new Mock(ActionInvocation.class);
+        mockActionInvocation.expectAndReturn("getAction", action);
+        ActionContext.getContext().setActionInvocation((ActionInvocation) mockActionInvocation.proxy());
+
+        String message = localizedTextProvider.findText(ModelDrivenAction2.class, "test.foo", Locale.getDefault());
+        assertEquals("Foo!", message);
+    }
+
+    public void testFindTextInPackage() throws Exception {
+        ModelDriven action = new ModelDrivenAction2();
+
+        Mock mockActionInvocation = new Mock(ActionInvocation.class);
+        mockActionInvocation.expectAndReturn("getAction", action);
+        ActionContext.getContext().setActionInvocation((ActionInvocation) mockActionInvocation.proxy());
+
+        String message = localizedTextProvider.findText(ModelDrivenAction2.class, "package.properties", Locale.getDefault());
+        assertEquals("It works!", message);
+    }
+
+    public void testParameterizedDefaultMessage() throws Exception {
+        String message = localizedTextProvider.findDefaultText("xwork.exception.missing-action", Locale.getDefault(), new String[]{"AddUser"});
+        assertEquals("There is no Action mapped for action name AddUser.", message);
+    }
+
+    public void testParameterizedDefaultMessageWithPackage() throws Exception {
+        String message = localizedTextProvider.findDefaultText("xwork.exception.missing-package-action", Locale.getDefault(), new String[]{"blah", "AddUser"});
+        assertEquals("There is no Action mapped for namespace blah and action name AddUser.", message);
+    }
+
+    public void testLocalizedDateFormatIsUsed() throws ParseException {
+        localizedTextProvider.addDefaultResourceBundle("com/opensymphony/xwork2/util/LocalizedTextUtilTest");
+        Date date = DateFormat.getDateInstance(DateFormat.SHORT, Locale.US).parse("01/01/2015");
+        Object[] params = new Object[]{ date };
+        String usDate = localizedTextProvider.findDefaultText("test.format.date", Locale.US, params);
+        String germanDate = localizedTextProvider.findDefaultText("test.format.date", Locale.GERMANY, params);
+        assertEquals(usDate, "1/1/15");
+        assertEquals(germanDate, "01.01.15");
+    }
+
+    public void testXW377() {
+        localizedTextProvider.addDefaultResourceBundle("com/opensymphony/xwork2/util/LocalizedTextUtilTest");
+
+        String text = localizedTextProvider.findText(Bar.class, "xw377", ActionContext.getContext().getLocale(), "xw377", null, ActionContext.getContext().getValueStack());
+        assertEquals("xw377", text); // should not log
+
+        String text2 = localizedTextProvider.findText(DefaultLocalizedTextProviderTest.class, "notinbundle", ActionContext.getContext().getLocale(), "hello", null, ActionContext.getContext().getValueStack());
+        assertEquals("hello", text2); // should log WARN
+
+        String text3 = localizedTextProvider.findText(DefaultLocalizedTextProviderTest.class, "notinbundle.key", ActionContext.getContext().getLocale(), "notinbundle.key", null, ActionContext.getContext().getValueStack());
+        assertEquals("notinbundle.key", text3); // should log WARN
+
+        String text4 = localizedTextProvider.findText(DefaultLocalizedTextProviderTest.class, "xw377", ActionContext.getContext().getLocale(), "hello", null, ActionContext.getContext().getValueStack());
+        assertEquals("xw377", text4); // should not log
+
+        String text5 = localizedTextProvider.findText(DefaultLocalizedTextProviderTest.class, "username", ActionContext.getContext().getLocale(), null, null, ActionContext.getContext().getValueStack());
+        assertEquals("Santa", text5); // should not log
+    }
+
+    public void testXW404() {
+        // This tests will try to load bundles from the 3 locales but we only have files for France and Germany.
+        // Before this fix loading the bundle for Germany failed since Italy have previously failed and thus the misses cache
+        // contained a false entry
+
+        ResourceBundle rbFrance = localizedTextProvider.findResourceBundle("com/opensymphony/xwork2/util/XW404", Locale.FRANCE);
+        ResourceBundle rbItaly = localizedTextProvider.findResourceBundle("com/opensymphony/xwork2/util/XW404", Locale.ITALY);
+        ResourceBundle rbGermany = localizedTextProvider.findResourceBundle("com/opensymphony/xwork2/util/XW404", Locale.GERMANY);
+
+        assertNotNull(rbFrance);
+        assertEquals("Bonjour", rbFrance.getString("hello"));
+
+        assertNull(rbItaly);
+
+        assertNotNull(rbGermany);
+        assertEquals("Hallo", rbGermany.getString("hello"));
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        XmlConfigurationProvider provider = new XmlConfigurationProvider("xwork-sample.xml");
+        container.inject(provider);
+        loadConfigurationProviders(provider);
+
+        localizedTextProvider = container.getInstance(LocalizedTextProvider.class);
+        
+        ActionContext.getContext().setLocale(Locale.US);
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        localizedTextProvider = null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/core/src/test/java/com/opensymphony/xwork2/util/LocalizedTextUtilTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/util/LocalizedTextUtilTest.java b/core/src/test/java/com/opensymphony/xwork2/util/LocalizedTextUtilTest.java
deleted file mode 100644
index 75e5569..0000000
--- a/core/src/test/java/com/opensymphony/xwork2/util/LocalizedTextUtilTest.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Copyright 2002-2006,2009 The Apache Software Foundation.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.opensymphony.xwork2.util;
-
-import com.mockobjects.dynamic.Mock;
-import com.opensymphony.xwork2.*;
-import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
-import com.opensymphony.xwork2.test.ModelDrivenAction2;
-import com.opensymphony.xwork2.test.TestBean2;
-
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-
-/**
- * Unit test for {@link LocalizedTextUtil}.
- *
- * @author jcarreira
- * @author tm_jee
- * 
- * @version $Date$ $Id$
- */
-public class LocalizedTextUtilTest extends XWorkTestCase {
-
-    private LocalizedTextProvider localizedTextProvider;
-    
-	public void testNpeWhenClassIsPrimitive() throws Exception {
-		ValueStack stack = ActionContext.getContext().getValueStack();
-		stack.push(new MyObject());
-		String result = localizedTextProvider.findText(MyObject.class, "someObj.someI18nKey", Locale.ENGLISH, "default message", null, stack);
-		System.out.println(result);
-	}
-	
-	public static class MyObject extends ActionSupport {
-		public boolean getSomeObj() {
-			return true;
-		}
-	}
-	
-	public void testActionGetTextWithNullObject() throws Exception {
-		MyAction action = new MyAction();
-        container.inject(action);
-		
-		Mock mockActionInvocation = new Mock(ActionInvocation.class);
-        mockActionInvocation.expectAndReturn("getAction", action);
-        ActionContext.getContext().setActionInvocation((ActionInvocation) mockActionInvocation.proxy());
-		ActionContext.getContext().getValueStack().push(action);
-		
-		String message = action.getText("barObj.title");
-		assertEquals("Title:", message);
-	}
-	
-	
-	public static class MyAction extends ActionSupport {
-		private Bar testBean2;
-		
-		public Bar getBarObj() {
-			return testBean2;
-		}
-		public void setBarObj(Bar testBean2) {
-			this.testBean2 = testBean2;
-		}
-	}
-	
-    public void testActionGetText() throws Exception {
-        ModelDrivenAction2 action = new ModelDrivenAction2();
-        container.inject(action);
-
-        TestBean2 bean = (TestBean2) action.getModel();
-        Bar bar = new Bar();
-        bean.setBarObj(bar);
-
-        Mock mockActionInvocation = new Mock(ActionInvocation.class);
-        mockActionInvocation.expectAndReturn("getAction", action);
-        ActionContext.getContext().setActionInvocation((ActionInvocation) mockActionInvocation.proxy());
-        ActionContext.getContext().getValueStack().push(action);
-        ActionContext.getContext().getValueStack().push(action.getModel());
-
-        String message = action.getText("barObj.title");
-        assertEquals("Title:", message);
-    }
-
-    public void testNullKeys() {
-        localizedTextProvider.findText(this.getClass(), null, Locale.getDefault());
-    }
-
-    public void testActionGetTextXXX() throws Exception {
-        localizedTextProvider.addDefaultResourceBundle("com/opensymphony/xwork2/util/FindMe");
-
-        SimpleAction action = new SimpleAction();
-        container.inject(action);
-
-        Mock mockActionInvocation = new Mock(ActionInvocation.class);
-        mockActionInvocation.expectAndReturn("getAction", action);
-        ActionContext.getContext().setActionInvocation((ActionInvocation) mockActionInvocation.proxy());
-        ActionContext.getContext().getValueStack().push(action);
-
-        String message = action.getText("bean.name");
-        String foundBean2 = action.getText("bean2.name");
-
-        assertEquals("Okay! You found Me!", foundBean2);
-        assertEquals("Haha you cant FindMe!", message);
-    }
-
-    public void testAddDefaultResourceBundle() {
-        String text = localizedTextProvider.findDefaultText("foo.range", Locale.getDefault());
-        assertNull("Found message when it should not be available.", text);
-
-        localizedTextProvider.addDefaultResourceBundle("com/opensymphony/xwork2/SimpleAction");
-
-        String message = localizedTextProvider.findDefaultText("foo.range", Locale.US);
-        assertEquals("Foo Range Message", message);
-    }
-
-    public void testAddDefaultResourceBundle2() throws Exception {
-        localizedTextProvider.addDefaultResourceBundle("com/opensymphony/xwork2/SimpleAction");
-
-        ActionProxy proxy = actionProxyFactory.createActionProxy("/", "packagelessAction", null, new HashMap<String, Object>(), false, true);
-        proxy.execute();
-    }
-
-    public void testDefaultMessage() throws Exception {
-        String message = localizedTextProvider.findDefaultText("xwork.error.action.execution", Locale.getDefault());
-        assertEquals("Error during Action invocation", message);
-    }
-
-    public void testDefaultMessageOverride() throws Exception {
-        String message = localizedTextProvider.findDefaultText("xwork.error.action.execution", Locale.getDefault());
-        assertEquals("Error during Action invocation", message);
-
-        localizedTextProvider.addDefaultResourceBundle("com/opensymphony/xwork2/test");
-
-        message = localizedTextProvider.findDefaultText("xwork.error.action.execution", Locale.getDefault());
-        assertEquals("Testing resource bundle override", message);
-    }
-
-    public void testFindTextInChildProperty() throws Exception {
-        ModelDriven action = new ModelDrivenAction2();
-        TestBean2 bean = (TestBean2) action.getModel();
-        Bar bar = new Bar();
-        bean.setBarObj(bar);
-
-        Mock mockActionInvocation = new Mock(ActionInvocation.class);
-        mockActionInvocation.expectAndReturn("hashCode", 0);
-        mockActionInvocation.expectAndReturn("getAction", action);
-        ActionContext.getContext().setActionInvocation((ActionInvocation) mockActionInvocation.proxy());
-        ActionContext.getContext().getValueStack().push(action);
-        ActionContext.getContext().getValueStack().push(action.getModel());
-
-        String message = localizedTextProvider.findText(ModelDrivenAction2.class, "invalid.fieldvalue.barObj.title", Locale.getDefault());
-        assertEquals("Title is invalid!", message);
-    }
-
-    public void testFindTextInInterface() throws Exception {
-        Action action = new ModelDrivenAction2();
-        Mock mockActionInvocation = new Mock(ActionInvocation.class);
-        mockActionInvocation.expectAndReturn("getAction", action);
-        ActionContext.getContext().setActionInvocation((ActionInvocation) mockActionInvocation.proxy());
-
-        String message = localizedTextProvider.findText(ModelDrivenAction2.class, "test.foo", Locale.getDefault());
-        assertEquals("Foo!", message);
-    }
-
-    public void testFindTextInPackage() throws Exception {
-        ModelDriven action = new ModelDrivenAction2();
-
-        Mock mockActionInvocation = new Mock(ActionInvocation.class);
-        mockActionInvocation.expectAndReturn("getAction", action);
-        ActionContext.getContext().setActionInvocation((ActionInvocation) mockActionInvocation.proxy());
-
-        String message = localizedTextProvider.findText(ModelDrivenAction2.class, "package.properties", Locale.getDefault());
-        assertEquals("It works!", message);
-    }
-
-    public void testParameterizedDefaultMessage() throws Exception {
-        String message = localizedTextProvider.findDefaultText("xwork.exception.missing-action", Locale.getDefault(), new String[]{"AddUser"});
-        assertEquals("There is no Action mapped for action name AddUser.", message);
-    }
-
-    public void testParameterizedDefaultMessageWithPackage() throws Exception {
-        String message = localizedTextProvider.findDefaultText("xwork.exception.missing-package-action", Locale.getDefault(), new String[]{"blah", "AddUser"});
-        assertEquals("There is no Action mapped for namespace blah and action name AddUser.", message);
-    }
-
-    public void testLocalizedDateFormatIsUsed() throws ParseException {
-        localizedTextProvider.addDefaultResourceBundle("com/opensymphony/xwork2/util/LocalizedTextUtilTest");
-        Date date = DateFormat.getDateInstance(DateFormat.SHORT, Locale.US).parse("01/01/2015");
-        Object[] params = new Object[]{ date };
-        String usDate = localizedTextProvider.findDefaultText("test.format.date", Locale.US, params);
-        String germanDate = localizedTextProvider.findDefaultText("test.format.date", Locale.GERMANY, params);
-        assertEquals(usDate, "1/1/15");
-        assertEquals(germanDate, "01.01.15");
-    }
-
-    public void testXW377() {
-        localizedTextProvider.addDefaultResourceBundle("com/opensymphony/xwork2/util/LocalizedTextUtilTest");
-
-        String text = localizedTextProvider.findText(Bar.class, "xw377", ActionContext.getContext().getLocale(), "xw377", null, ActionContext.getContext().getValueStack());
-        assertEquals("xw377", text); // should not log
-
-        String text2 = localizedTextProvider.findText(LocalizedTextUtilTest.class, "notinbundle", ActionContext.getContext().getLocale(), "hello", null, ActionContext.getContext().getValueStack());
-        assertEquals("hello", text2); // should log WARN
-
-        String text3 = localizedTextProvider.findText(LocalizedTextUtilTest.class, "notinbundle.key", ActionContext.getContext().getLocale(), "notinbundle.key", null, ActionContext.getContext().getValueStack());
-        assertEquals("notinbundle.key", text3); // should log WARN
-
-        String text4 = localizedTextProvider.findText(LocalizedTextUtilTest.class, "xw377", ActionContext.getContext().getLocale(), "hello", null, ActionContext.getContext().getValueStack());
-        assertEquals("xw377", text4); // should not log
-
-        String text5 = localizedTextProvider.findText(LocalizedTextUtilTest.class, "username", ActionContext.getContext().getLocale(), null, null, ActionContext.getContext().getValueStack());
-        assertEquals("Santa", text5); // should not log
-    }
-
-    public void testXW404() {
-        // This tests will try to load bundles from the 3 locales but we only have files for France and Germany.
-        // Before this fix loading the bundle for Germany failed since Italy have previously failed and thus the misses cache
-        // contained a false entry
-
-        ResourceBundle rbFrance = localizedTextProvider.findResourceBundle("com/opensymphony/xwork2/util/XW404", Locale.FRANCE);
-        ResourceBundle rbItaly = localizedTextProvider.findResourceBundle("com/opensymphony/xwork2/util/XW404", Locale.ITALY);
-        ResourceBundle rbGermany = localizedTextProvider.findResourceBundle("com/opensymphony/xwork2/util/XW404", Locale.GERMANY);
-
-        assertNotNull(rbFrance);
-        assertEquals("Bonjour", rbFrance.getString("hello"));
-
-        assertNull(rbItaly);
-
-        assertNotNull(rbGermany);
-        assertEquals("Hallo", rbGermany.getString("hello"));
-    }
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        XmlConfigurationProvider provider = new XmlConfigurationProvider("xwork-sample.xml");
-        container.inject(provider);
-        loadConfigurationProviders(provider);
-
-        localizedTextProvider = container.getInstance(LocalizedTextProvider.class);
-        
-        ActionContext.getContext().setLocale(Locale.US);
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        super.tearDown();
-        localizedTextProvider = null;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/core/src/test/java/org/apache/struts2/components/ComponentTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/components/ComponentTest.java b/core/src/test/java/org/apache/struts2/components/ComponentTest.java
index 80cf82b..dffa5d7 100644
--- a/core/src/test/java/org/apache/struts2/components/ComponentTest.java
+++ b/core/src/test/java/org/apache/struts2/components/ComponentTest.java
@@ -46,7 +46,6 @@ import org.apache.struts2.views.jsp.ui.TextFieldTag;
 import org.apache.struts2.views.jsp.ui.UpDownSelectTag;
 
 import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
 
 /**
  * Test case for method findAncestor(Class) in Component and some commons

http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/core/src/test/java/org/apache/struts2/config/DefaultBeanSelectionProviderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/config/DefaultBeanSelectionProviderTest.java b/core/src/test/java/org/apache/struts2/config/DefaultBeanSelectionProviderTest.java
index 771c056..ab7ee0d 100644
--- a/core/src/test/java/org/apache/struts2/config/DefaultBeanSelectionProviderTest.java
+++ b/core/src/test/java/org/apache/struts2/config/DefaultBeanSelectionProviderTest.java
@@ -25,14 +25,11 @@ import java.util.Locale;
 
 import com.opensymphony.xwork2.XWorkTestCase;
 import com.opensymphony.xwork2.LocalizedTextProvider;
-import com.opensymphony.xwork2.config.Configuration;
 import com.opensymphony.xwork2.config.ConfigurationException;
-import com.opensymphony.xwork2.config.ConfigurationProvider;
 import com.opensymphony.xwork2.test.StubConfigurationProvider;
 import org.apache.struts2.StrutsConstants;
 
 import com.opensymphony.xwork2.inject.ContainerBuilder;
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
 import com.opensymphony.xwork2.util.location.LocatableProperties;
 
 public class DefaultBeanSelectionProviderTest extends XWorkTestCase {

http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/core/src/test/java/org/apache/struts2/config/PropertiesConfigurationProviderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/config/PropertiesConfigurationProviderTest.java b/core/src/test/java/org/apache/struts2/config/PropertiesConfigurationProviderTest.java
index 123f8eb..05606ce 100644
--- a/core/src/test/java/org/apache/struts2/config/PropertiesConfigurationProviderTest.java
+++ b/core/src/test/java/org/apache/struts2/config/PropertiesConfigurationProviderTest.java
@@ -23,7 +23,7 @@ package org.apache.struts2.config;
 
 import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.inject.ContainerBuilder;
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
+import com.opensymphony.xwork2.util.DefaultLocalizedTextProvider;
 import com.opensymphony.xwork2.util.location.LocatableProperties;
 import junit.framework.TestCase;
 import org.apache.struts2.StrutsConstants;
@@ -49,7 +49,7 @@ public class PropertiesConfigurationProviderTest extends TestCase {
         Container container = builder.create(true);
 
         String localeStr = container.getInstance(String.class, StrutsConstants.STRUTS_LOCALE);
-        Locale locale = LocalizedTextUtil.localeFromString(localeStr, Locale.FRANCE);
+        Locale locale = DefaultLocalizedTextProvider.localeFromString(localeStr, Locale.FRANCE);
 
         assertNotNull(locale);
         assertEquals("DE", locale.getCountry());
@@ -68,7 +68,7 @@ public class PropertiesConfigurationProviderTest extends TestCase {
         Container container = builder.create(true);
 
         String localeStr = container.getInstance(String.class, StrutsConstants.STRUTS_LOCALE);
-        Locale locale = LocalizedTextUtil.localeFromString(localeStr, Locale.getDefault());
+        Locale locale = DefaultLocalizedTextProvider.localeFromString(localeStr, Locale.getDefault());
 
         assertNotNull(locale);
         Locale vmLocale = Locale.getDefault();

http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/core/src/test/java/org/apache/struts2/config/SettingsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/config/SettingsTest.java b/core/src/test/java/org/apache/struts2/config/SettingsTest.java
index 9f92f7d..11aacfc 100644
--- a/core/src/test/java/org/apache/struts2/config/SettingsTest.java
+++ b/core/src/test/java/org/apache/struts2/config/SettingsTest.java
@@ -22,7 +22,6 @@
 package org.apache.struts2.config;
 
 import com.opensymphony.xwork2.LocalizedTextProvider;
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
 import org.apache.struts2.StrutsConstants;
 import org.apache.struts2.StrutsInternalTestCase;
 

http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/plugins/pell-multipart/src/main/java/org/apache/struts2/dispatcher/multipart/PellMultiPartRequest.java
----------------------------------------------------------------------
diff --git a/plugins/pell-multipart/src/main/java/org/apache/struts2/dispatcher/multipart/PellMultiPartRequest.java b/plugins/pell-multipart/src/main/java/org/apache/struts2/dispatcher/multipart/PellMultiPartRequest.java
index c91c52e..9dba92e 100644
--- a/plugins/pell-multipart/src/main/java/org/apache/struts2/dispatcher/multipart/PellMultiPartRequest.java
+++ b/plugins/pell-multipart/src/main/java/org/apache/struts2/dispatcher/multipart/PellMultiPartRequest.java
@@ -21,7 +21,6 @@
 
 package org.apache.struts2.dispatcher.multipart;
 
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.LogManager;
 import http.utils.multipartrequest.ServletMultipartRequest;
@@ -32,7 +31,6 @@ import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.List;
-import java.util.Locale;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java
----------------------------------------------------------------------
diff --git a/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java b/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java
index 42d7e30..9a15b87 100644
--- a/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java
+++ b/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java
@@ -26,8 +26,7 @@ import com.opensymphony.xwork2.ActionProxy;
 import com.opensymphony.xwork2.ActionProxyFactory;
 import com.opensymphony.xwork2.config.ConfigurationException;
 import com.opensymphony.xwork2.inject.Container;
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
-import com.sun.net.httpserver.HttpsParameters;
+import com.opensymphony.xwork2.util.DefaultLocalizedTextProvider;
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.LogManager;
 import org.apache.commons.lang3.StringUtils;
@@ -397,7 +396,7 @@ public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics {
         String defaultLocale = container.getInstance(String.class, StrutsConstants.STRUTS_LOCALE);
         Locale locale;
         if (defaultLocale != null) {
-            locale = LocalizedTextUtil.localeFromString(defaultLocale, request.getLocale());
+            locale = DefaultLocalizedTextProvider.localeFromString(defaultLocale, request.getLocale());
         } else {
             locale = request.getLocale();
         }


[10/24] struts git commit: Marks deprecated constructor

Posted by lu...@apache.org.
Marks deprecated constructor


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

Branch: refs/heads/master
Commit: 442a52fe48745bc03b3d6b15e74a01cdf0c9f6a1
Parents: 0b16543
Author: Lukasz Lenart <lu...@apache.org>
Authored: Thu Mar 9 09:43:38 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Thu Mar 9 09:43:38 2017 +0100

----------------------------------------------------------------------
 .../xwork2/validator/DelegatingValidatorContext.java           | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/442a52fe/core/src/main/java/com/opensymphony/xwork2/validator/DelegatingValidatorContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/DelegatingValidatorContext.java b/core/src/main/java/com/opensymphony/xwork2/validator/DelegatingValidatorContext.java
index abaa761..e35d7a8 100644
--- a/core/src/main/java/com/opensymphony/xwork2/validator/DelegatingValidatorContext.java
+++ b/core/src/main/java/com/opensymphony/xwork2/validator/DelegatingValidatorContext.java
@@ -56,7 +56,10 @@ public class DelegatingValidatorContext implements ValidatorContext {
      * (validation aware instance and a locale and text provider) are created based on the given action.
      *
      * @param object the object to use for validation (usually an Action).
+     *
+     * @deprecated will be removed, do not use!
      */
+    @Deprecated
     public DelegatingValidatorContext(Object object) {
         this.localeProvider = makeLocaleProvider(object);
         this.validationAware = makeValidationAware(object);
@@ -68,7 +71,10 @@ public class DelegatingValidatorContext implements ValidatorContext {
      * the validation context are created based on the class.
      *
      * @param clazz the class to initialize the context with.
+     *
+     * @deprecated will be removed, do not use!
      */
+    @Deprecated
     public DelegatingValidatorContext(Class clazz) {
         localeProvider = new ActionContextLocaleProvider();
         textProvider = new TextProviderFactory().createInstance(clazz, localeProvider);


[22/24] struts git commit: Drops unused function

Posted by lu...@apache.org.
Drops unused function


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

Branch: refs/heads/master
Commit: 3a84a626f964056428fd4ca2b006610d25136e19
Parents: 008c28a
Author: Lukasz Lenart <lu...@apache.org>
Authored: Tue Mar 14 10:03:07 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Tue Mar 14 10:03:07 2017 +0100

----------------------------------------------------------------------
 .../main/java/com/opensymphony/xwork2/LocalizedTextProvider.java   | 2 --
 .../com/opensymphony/xwork2/util/DefaultLocalizedTextProvider.java | 1 -
 2 files changed, 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/3a84a626/core/src/main/java/com/opensymphony/xwork2/LocalizedTextProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/LocalizedTextProvider.java b/core/src/main/java/com/opensymphony/xwork2/LocalizedTextProvider.java
index ecd037d..85c5458 100644
--- a/core/src/main/java/com/opensymphony/xwork2/LocalizedTextProvider.java
+++ b/core/src/main/java/com/opensymphony/xwork2/LocalizedTextProvider.java
@@ -47,6 +47,4 @@ public interface LocalizedTextProvider extends Serializable {
 
     void addDefaultResourceBundle(String resourceBundleName);
 
-    @Deprecated
-    void reset();
 }

http://git-wip-us.apache.org/repos/asf/struts/blob/3a84a626/core/src/main/java/com/opensymphony/xwork2/util/DefaultLocalizedTextProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/util/DefaultLocalizedTextProvider.java b/core/src/main/java/com/opensymphony/xwork2/util/DefaultLocalizedTextProvider.java
index 1e55fdd..c515219 100644
--- a/core/src/main/java/com/opensymphony/xwork2/util/DefaultLocalizedTextProvider.java
+++ b/core/src/main/java/com/opensymphony/xwork2/util/DefaultLocalizedTextProvider.java
@@ -972,7 +972,6 @@ public class DefaultLocalizedTextProvider implements LocalizedTextProvider {
      *
      * @deprecated used only in tests
      */
-    @Override
     @Deprecated
     public void reset() {
         // no-op


[12/24] struts git commit: Puts back the default bean name to allow alias beans

Posted by lu...@apache.org.
Puts back the default bean name to allow alias beans


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

Branch: refs/heads/master
Commit: 6c19875c786c03a33658f633d5c6a3425bbd5aaf
Parents: 1ab616b
Author: Lukasz Lenart <lu...@apache.org>
Authored: Thu Mar 9 10:19:12 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Thu Mar 9 10:19:12 2017 +0100

----------------------------------------------------------------------
 .../java/com/opensymphony/xwork2/XWork.java     | 79 --------------------
 .../xwork2/config/ConfigurationManager.java     |  4 -
 .../config/impl/DefaultConfiguration.java       |  7 +-
 .../xwork2/util/XWorkTestCaseHelper.java        |  4 +-
 .../org/apache/struts2/StrutsConstants.java     |  2 +
 .../config/AbstractBeanSelectionProvider.java   |  9 ++-
 .../config/DefaultBeanSelectionProvider.java    |  3 +-
 .../apache/struts2/dispatcher/Dispatcher.java   |  2 +-
 .../xwork2/config/ConfigurationManagerTest.java |  3 +-
 ...tionProviderGlobalResultInheritenceTest.java |  3 +-
 .../struts2/dispatcher/DispatcherTest.java      | 14 ++--
 .../mapper/CompositeActionMapperTest.java       |  4 +-
 .../mapper/DefaultActionMapperTest.java         |  5 +-
 .../mapper/Restful2ActionMapperTest.java        |  3 +-
 .../struts2/rest/RestActionMapperTest.java      |  3 +-
 .../sitegraph/StrutsConfigRetriever.java        |  3 +-
 16 files changed, 39 insertions(+), 109 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/6c19875c/core/src/main/java/com/opensymphony/xwork2/XWork.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/XWork.java b/core/src/main/java/com/opensymphony/xwork2/XWork.java
deleted file mode 100644
index 1619a93..0000000
--- a/core/src/main/java/com/opensymphony/xwork2/XWork.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2002-2006,2009 The Apache Software Foundation.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.opensymphony.xwork2;
-
-import com.opensymphony.xwork2.config.Configuration;
-import com.opensymphony.xwork2.config.ConfigurationManager;
-import com.opensymphony.xwork2.util.logging.LoggerFactory;
-
-import java.util.Collections;
-import java.util.Map;
-
-/**
- * Simple facade to make using XWork standalone easier
- */
-public class XWork {
-    
-    ConfigurationManager configurationManager;
-    
-    public XWork() {
-        this(new ConfigurationManager());
-    }
-    
-    public XWork(ConfigurationManager mgr) {
-        this.configurationManager = mgr;
-    }
-    
-    public void setLoggerFactory(LoggerFactory factory) {
-        LoggerFactory.setLoggerFactory(factory);
-    }
-    
-    /**
-     * Executes an action
-     * 
-     * @param namespace The namespace
-     * @param name The action name
-     * @param method The method name
-     * @throws XWorkException If anything goes wrong
-     */
-    public void executeAction(String namespace, String name, String method) throws XWorkException {
-        Map<String, Object> extraContext = Collections.emptyMap();
-        executeAction(namespace, name, method, extraContext);
-    }
-    
-    /**
-     * Executes an action with extra context information
-     * 
-     * @param namespace The namespace
-     * @param name The action name
-     * @param method The method name
-     * @param extraContext A map of extra context information
-     * @throws XWorkException If anything goes wrong
-     */
-    public void executeAction(String namespace, String name, String method, Map<String, Object> extraContext) throws XWorkException {
-        Configuration config = configurationManager.getConfiguration();
-        try {
-            ActionProxy proxy = config.getContainer().getInstance(ActionProxyFactory.class).createActionProxy(
-                    namespace, name, method, extraContext, true, false);
-        
-            proxy.execute();
-        } catch (Exception e) {
-            throw new XWorkException(e);
-        } finally {
-            ActionContext.setContext(null);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/struts/blob/6c19875c/core/src/main/java/com/opensymphony/xwork2/config/ConfigurationManager.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/config/ConfigurationManager.java b/core/src/main/java/com/opensymphony/xwork2/config/ConfigurationManager.java
index ea51c63..f937e9d 100644
--- a/core/src/main/java/com/opensymphony/xwork2/config/ConfigurationManager.java
+++ b/core/src/main/java/com/opensymphony/xwork2/config/ConfigurationManager.java
@@ -47,10 +47,6 @@ public class ConfigurationManager {
     private boolean providersChanged = false;
     private boolean reloadConfigs = true; // for the first time
 
-    public ConfigurationManager() {
-        this("xwork");
-    }
-    
     public ConfigurationManager(String name) {
         this.defaultFrameworkBeanName = name;
     }

http://git-wip-us.apache.org/repos/asf/struts/blob/6c19875c/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java b/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
index 9830d92..89be0fa 100644
--- a/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
+++ b/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
@@ -51,11 +51,8 @@ import java.util.*;
  */
 public class DefaultConfiguration implements Configuration {
 
-    public static final String DEFAULT_BEAN_NAME = "struts";
-
     protected static final Logger LOG = LogManager.getLogger(DefaultConfiguration.class);
 
-
     // Programmatic Action Configurations
     protected Map<String, PackageConfig> packageContexts = new LinkedHashMap<>();
     protected RuntimeConfiguration runtimeConfiguration;
@@ -68,7 +65,7 @@ public class DefaultConfiguration implements Configuration {
     ObjectFactory objectFactory;
 
     public DefaultConfiguration() {
-        this(DEFAULT_BEAN_NAME);
+        this(Container.DEFAULT_NAME);
     }
 
     public DefaultConfiguration(String defaultBeanName) {
@@ -266,6 +263,8 @@ public class DefaultConfiguration implements Configuration {
 
         builder.factory(TextParser.class, OgnlTextParser.class, Scope.SINGLETON);
         builder.factory(TextProvider.class, "system", DefaultTextProvider.class, Scope.SINGLETON);
+        builder.factory(TextProvider.class, TextProviderSupport.class, Scope.SINGLETON);
+        builder.factory(LocaleProvider.class, DefaultLocaleProvider.class, Scope.SINGLETON);
 
         builder.factory(ObjectTypeDeterminer.class, DefaultObjectTypeDeterminer.class, Scope.SINGLETON);
         builder.factory(PropertyAccessor.class, CompoundRoot.class.getName(), CompoundRootAccessor.class, Scope.SINGLETON);

http://git-wip-us.apache.org/repos/asf/struts/blob/6c19875c/core/src/main/java/com/opensymphony/xwork2/util/XWorkTestCaseHelper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/util/XWorkTestCaseHelper.java b/core/src/main/java/com/opensymphony/xwork2/util/XWorkTestCaseHelper.java
index 717a3ef..0cabd0f 100644
--- a/core/src/main/java/com/opensymphony/xwork2/util/XWorkTestCaseHelper.java
+++ b/core/src/main/java/com/opensymphony/xwork2/util/XWorkTestCaseHelper.java
@@ -29,7 +29,7 @@ import com.opensymphony.xwork2.util.location.LocatableProperties;
 public class XWorkTestCaseHelper {
 
     public static ConfigurationManager setUp() throws Exception {
-        ConfigurationManager configurationManager = new ConfigurationManager();
+        ConfigurationManager configurationManager = new ConfigurationManager(Container.DEFAULT_NAME);
         configurationManager.addContainerProvider(new XWorkConfigurationProvider());
         Configuration config = configurationManager.getConfiguration();
         Container container = config.getContainer();
@@ -54,7 +54,7 @@ public class XWorkTestCaseHelper {
         } catch (Exception e) {
             throw new RuntimeException("Cannot clean old configuration", e);
         }
-        configurationManager = new ConfigurationManager();
+        configurationManager = new ConfigurationManager(Container.DEFAULT_NAME);
         configurationManager.addContainerProvider(new ContainerProvider() {
             public void destroy() {}
             public void init(Configuration configuration) throws ConfigurationException {}

http://git-wip-us.apache.org/repos/asf/struts/blob/6c19875c/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 c41d542..99eb18e 100644
--- a/core/src/main/java/org/apache/struts2/StrutsConstants.java
+++ b/core/src/main/java/org/apache/struts2/StrutsConstants.java
@@ -306,4 +306,6 @@ public final class StrutsConstants {
     public static final String STRUTS_CONTENT_TYPE_MATCHER = "struts.contentTypeMatcher";
 
     public static final String STRUTS_SMI_METHOD_REGEX = "struts.strictMethodInvocation.methodRegex";
+
+    public static final String STRUTS_LOCALIZED_TEXT_PROVIDER = "struts.localizedTextProvider";
 }

http://git-wip-us.apache.org/repos/asf/struts/blob/6c19875c/core/src/main/java/org/apache/struts2/config/AbstractBeanSelectionProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/config/AbstractBeanSelectionProvider.java b/core/src/main/java/org/apache/struts2/config/AbstractBeanSelectionProvider.java
index f0c691f..664c6f4 100644
--- a/core/src/main/java/org/apache/struts2/config/AbstractBeanSelectionProvider.java
+++ b/core/src/main/java/org/apache/struts2/config/AbstractBeanSelectionProvider.java
@@ -4,7 +4,6 @@ import com.opensymphony.xwork2.ObjectFactory;
 import com.opensymphony.xwork2.config.BeanSelectionProvider;
 import com.opensymphony.xwork2.config.Configuration;
 import com.opensymphony.xwork2.config.ConfigurationException;
-import com.opensymphony.xwork2.config.impl.DefaultConfiguration;
 import com.opensymphony.xwork2.inject.*;
 import com.opensymphony.xwork2.util.ClassLoaderUtil;
 import com.opensymphony.xwork2.util.location.LocatableProperties;
@@ -20,6 +19,8 @@ public abstract class AbstractBeanSelectionProvider implements BeanSelectionProv
 
     private static final Logger LOG = LogManager.getLogger(AbstractBeanSelectionProvider.class);
 
+    public static final String DEFAULT_BEAN_NAME = "struts";
+
     public void destroy() {
         // NO-OP
     }
@@ -41,8 +42,8 @@ public abstract class AbstractBeanSelectionProvider implements BeanSelectionProv
     }
 
     protected void alias(Class type, String key, ContainerBuilder builder, Properties props, Scope scope) {
-        if (!builder.contains(type)) {
-            String foundName = props.getProperty(key, DefaultConfiguration.DEFAULT_BEAN_NAME);
+        if (!builder.contains(type, Container.DEFAULT_NAME)) {
+            String foundName = props.getProperty(key, DEFAULT_BEAN_NAME);
             if (builder.contains(type, foundName)) {
                 LOG.trace("Choosing bean ({}) for ({})", foundName, type.getName());
                 builder.alias(type, foundName, Container.DEFAULT_NAME);
@@ -54,7 +55,7 @@ public abstract class AbstractBeanSelectionProvider implements BeanSelectionProv
                 } catch (ClassNotFoundException ex) {
                     // Perhaps a spring bean id, so we'll delegate to the object factory at runtime
                     LOG.trace("Choosing bean ({}) for ({}) to be loaded from the ObjectFactory", foundName, type.getName());
-                    if (DefaultConfiguration.DEFAULT_BEAN_NAME.equals(foundName)) {
+                    if (DEFAULT_BEAN_NAME.equals(foundName)) {
                         // Probably an optional bean, will ignore
                     } else {
                         if (ObjectFactory.class != type) {

http://git-wip-us.apache.org/repos/asf/struts/blob/6c19875c/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 20b0f99..b417333 100644
--- a/core/src/main/java/org/apache/struts2/config/DefaultBeanSelectionProvider.java
+++ b/core/src/main/java/org/apache/struts2/config/DefaultBeanSelectionProvider.java
@@ -387,8 +387,9 @@ public class DefaultBeanSelectionProvider extends AbstractBeanSelectionProvider
         alias(TypeConverterHolder.class, StrutsConstants.STRUTS_CONVERTER_HOLDER, builder, props);
 
         alias(TextProvider.class, StrutsConstants.STRUTS_XWORKTEXTPROVIDER, builder, props, Scope.PROTOTYPE);
-
         alias(LocaleProvider.class, StrutsConstants.STRUTS_LOCALE_PROVIDER, builder, props);
+        alias(LocalizedTextUtil.class, StrutsConstants.STRUTS_LOCALIZED_TEXT_PROVIDER, builder, props);
+
         alias(ActionProxyFactory.class, StrutsConstants.STRUTS_ACTIONPROXYFACTORY, builder, props);
         alias(ObjectTypeDeterminer.class, StrutsConstants.STRUTS_OBJECTTYPEDETERMINER, builder, props);
         alias(ActionMapper.class, StrutsConstants.STRUTS_MAPPER_CLASS, builder, props);

http://git-wip-us.apache.org/repos/asf/struts/blob/6c19875c/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
index 98ad701..7b28117 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
@@ -456,7 +456,7 @@ public class Dispatcher {
     public void init() {
 
     	if (configurationManager == null) {
-    		configurationManager = createConfigurationManager(DefaultConfiguration.DEFAULT_BEAN_NAME);
+    		configurationManager = createConfigurationManager(Container.DEFAULT_NAME);
     	}
 
         try {

http://git-wip-us.apache.org/repos/asf/struts/blob/6c19875c/core/src/test/java/com/opensymphony/xwork2/config/ConfigurationManagerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/ConfigurationManagerTest.java b/core/src/test/java/com/opensymphony/xwork2/config/ConfigurationManagerTest.java
index e1d81bd..7804f7e 100644
--- a/core/src/test/java/com/opensymphony/xwork2/config/ConfigurationManagerTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/config/ConfigurationManagerTest.java
@@ -22,6 +22,7 @@ import com.mockobjects.dynamic.Mock;
 import com.opensymphony.xwork2.FileManagerFactory;
 import com.opensymphony.xwork2.XWorkTestCase;
 import com.opensymphony.xwork2.config.providers.XWorkConfigurationProvider;
+import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.inject.ContainerBuilder;
 import com.opensymphony.xwork2.util.location.LocatableProperties;
 
@@ -73,7 +74,7 @@ public class ConfigurationManagerTest extends XWorkTestCase {
     	}
     	
     	final State state = new State();
-    	ConfigurationManager configurationManager = new ConfigurationManager();
+    	ConfigurationManager configurationManager = new ConfigurationManager(Container.DEFAULT_NAME);
     	configurationManager.addContainerProvider(new ConfigurationProvider() {
 			public void destroy() { 
 				throw new RuntimeException("testing testing 123");

http://git-wip-us.apache.org/repos/asf/struts/blob/6c19875c/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderGlobalResultInheritenceTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderGlobalResultInheritenceTest.java b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderGlobalResultInheritenceTest.java
index e4553df..6a08349 100644
--- a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderGlobalResultInheritenceTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderGlobalResultInheritenceTest.java
@@ -6,6 +6,7 @@ import com.opensymphony.xwork2.config.ConfigurationManager;
 import com.opensymphony.xwork2.config.ConfigurationProvider;
 import com.opensymphony.xwork2.config.entities.ActionConfig;
 import com.opensymphony.xwork2.config.entities.ResultConfig;
+import com.opensymphony.xwork2.inject.Container;
 
 /**
  * <code>XmlConfigurationProviderGlobalResultInheritenceTest</code>
@@ -19,7 +20,7 @@ public class XmlConfigurationProviderGlobalResultInheritenceTest extends Configu
     public void testGlobalResultInheritenceTest() throws Exception {
         ConfigurationProvider provider = buildConfigurationProvider("com/opensymphony/xwork2/config/providers/xwork-test-global-result-inheritence.xml");
 
-        ConfigurationManager configurationManager = new ConfigurationManager();
+        ConfigurationManager configurationManager = new ConfigurationManager(Container.DEFAULT_NAME);
         configurationManager.addContainerProvider(new XWorkConfigurationProvider());
         configurationManager.addContainerProvider(provider);
         Configuration configuration = configurationManager.getConfiguration();

http://git-wip-us.apache.org/repos/asf/struts/blob/6c19875c/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java b/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
index c0994a5..91b0ebf 100644
--- a/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
+++ b/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
@@ -175,7 +175,7 @@ public class DispatcherTest extends StrutsInternalTestCase {
     
     public void testConfigurationManager() {
     	Dispatcher du;
-    	final InternalConfigurationManager configurationManager = new InternalConfigurationManager();
+    	final InternalConfigurationManager configurationManager = new InternalConfigurationManager(Container.DEFAULT_NAME);
     	try {
     		du = new MockDispatcher(new MockServletContext(), new HashMap<String, String>(), configurationManager);
     		du.init();
@@ -196,7 +196,7 @@ public class DispatcherTest extends StrutsInternalTestCase {
     public void testObjectFactoryDestroy() throws Exception {
 
         final InnerDestroyableObjectFactory destroyedObjectFactory = new InnerDestroyableObjectFactory();
-        ConfigurationManager cm = new ConfigurationManager();
+        ConfigurationManager cm = new ConfigurationManager(Container.DEFAULT_NAME);
         Dispatcher du = new MockDispatcher(new MockServletContext(), new HashMap<String, String>(), cm);
         Mock mockConfiguration = new Mock(Configuration.class);
         cm.setConfiguration((Configuration)mockConfiguration.proxy());
@@ -245,7 +245,7 @@ public class DispatcherTest extends StrutsInternalTestCase {
         mockConfiguration.matchAndReturn("getContainer", mockContainer.proxy());
         mockConfiguration.expect("destroy");
         
-        ConfigurationManager configurationManager = new ConfigurationManager();
+        ConfigurationManager configurationManager = new ConfigurationManager(Container.DEFAULT_NAME);
         configurationManager.setConfiguration((Configuration) mockConfiguration.proxy());
         
         Dispatcher dispatcher = new MockDispatcher(new MockServletContext(), new HashMap<String, String>(), configurationManager);
@@ -259,8 +259,12 @@ public class DispatcherTest extends StrutsInternalTestCase {
     
     class InternalConfigurationManager extends ConfigurationManager {
     	public boolean destroyConfiguration = false;
-    	
-    	@Override
+
+        public InternalConfigurationManager(String name) {
+            super(name);
+        }
+
+        @Override
     	public synchronized void destroyConfiguration() {
     		super.destroyConfiguration();
     		destroyConfiguration = true;

http://git-wip-us.apache.org/repos/asf/struts/blob/6c19875c/core/src/test/java/org/apache/struts2/dispatcher/mapper/CompositeActionMapperTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/dispatcher/mapper/CompositeActionMapperTest.java b/core/src/test/java/org/apache/struts2/dispatcher/mapper/CompositeActionMapperTest.java
index acd18bb..558ba67 100644
--- a/core/src/test/java/org/apache/struts2/dispatcher/mapper/CompositeActionMapperTest.java
+++ b/core/src/test/java/org/apache/struts2/dispatcher/mapper/CompositeActionMapperTest.java
@@ -51,7 +51,7 @@ public class CompositeActionMapperTest extends TestCase {
         mockContainer.expectAndReturn("getInstance", C.args(C.eq(ActionMapper.class), C.eq("mapper3")), mapper2);
         CompositeActionMapper compositeActionMapper = new CompositeActionMapper((Container) mockContainer.proxy(), "mapper1,mapper2,mapper3");
         
-        ActionMapping actionMapping = compositeActionMapper.getMapping(new MockHttpServletRequest(), new ConfigurationManager());
+        ActionMapping actionMapping = compositeActionMapper.getMapping(new MockHttpServletRequest(), new ConfigurationManager(Container.DEFAULT_NAME));
         String uri = compositeActionMapper.getUriFromActionMapping(new ActionMapping());
         mockContainer.verify();
         
@@ -69,7 +69,7 @@ public class CompositeActionMapperTest extends TestCase {
         mockContainer.expectAndReturn("getInstance", C.args(C.eq(ActionMapper.class), C.eq("mapper2")), mapper2);
         CompositeActionMapper compositeActionMapper = new CompositeActionMapper((Container) mockContainer.proxy(), "mapper1,mapper2");
 
-        ActionMapping actionMapping = compositeActionMapper.getMapping(new MockHttpServletRequest(), new ConfigurationManager());
+        ActionMapping actionMapping = compositeActionMapper.getMapping(new MockHttpServletRequest(), new ConfigurationManager(Container.DEFAULT_NAME));
         String uri = compositeActionMapper.getUriFromActionMapping(new ActionMapping());
         mockContainer.verify();
 

http://git-wip-us.apache.org/repos/asf/struts/blob/6c19875c/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java b/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java
index 2008e38..45bd6a2 100644
--- a/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java
+++ b/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java
@@ -29,6 +29,7 @@ import com.opensymphony.xwork2.config.Configuration;
 import com.opensymphony.xwork2.config.ConfigurationManager;
 import com.opensymphony.xwork2.config.entities.PackageConfig;
 import com.opensymphony.xwork2.config.impl.DefaultConfiguration;
+import com.opensymphony.xwork2.inject.Container;
 import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.StrutsException;
 import org.apache.struts2.StrutsInternalTestCase;
@@ -61,7 +62,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
         PackageConfig pkg2 = new PackageConfig.Builder("my").namespace("/my").build();
         config.addPackageConfig("mvns", pkg);
         config.addPackageConfig("my", pkg2);
-        configManager = new ConfigurationManager() {
+        configManager = new ConfigurationManager(Container.DEFAULT_NAME) {
             public Configuration getConfiguration() {
                 return config;
             }
@@ -139,7 +140,7 @@ public class DefaultActionMapperTest extends StrutsInternalTestCase {
         config.addPackageConfig("mvns", pkg);
         config.addPackageConfig("my", pkg2);
         config.addPackageConfig("root", pkg3);
-        configManager = new ConfigurationManager() {
+        configManager = new ConfigurationManager(Container.DEFAULT_NAME) {
             public Configuration getConfiguration() {
                 return config;
             }

http://git-wip-us.apache.org/repos/asf/struts/blob/6c19875c/core/src/test/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapperTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapperTest.java b/core/src/test/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapperTest.java
index 140ad64..42b95a3 100644
--- a/core/src/test/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapperTest.java
+++ b/core/src/test/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapperTest.java
@@ -21,6 +21,7 @@
 
 package org.apache.struts2.dispatcher.mapper;
 
+import com.opensymphony.xwork2.inject.Container;
 import org.apache.struts2.StrutsInternalTestCase;
 import com.mockobjects.servlet.MockHttpServletRequest;
 import com.opensymphony.xwork2.config.ConfigurationManager;
@@ -53,7 +54,7 @@ public class Restful2ActionMapperTest extends StrutsInternalTestCase {
             .namespace("/my").build();
         config.addPackageConfig("mvns", pkg);
         config.addPackageConfig("my", pkg2);
-        configManager = new ConfigurationManager() {
+        configManager = new ConfigurationManager(Container.DEFAULT_NAME) {
             public Configuration getConfiguration() {
                 return config;
             }

http://git-wip-us.apache.org/repos/asf/struts/blob/6c19875c/plugins/rest/src/test/java/org/apache/struts2/rest/RestActionMapperTest.java
----------------------------------------------------------------------
diff --git a/plugins/rest/src/test/java/org/apache/struts2/rest/RestActionMapperTest.java b/plugins/rest/src/test/java/org/apache/struts2/rest/RestActionMapperTest.java
index 5492816..8bfe159 100644
--- a/plugins/rest/src/test/java/org/apache/struts2/rest/RestActionMapperTest.java
+++ b/plugins/rest/src/test/java/org/apache/struts2/rest/RestActionMapperTest.java
@@ -25,6 +25,7 @@ import com.opensymphony.xwork2.config.Configuration;
 import com.opensymphony.xwork2.config.ConfigurationManager;
 import com.opensymphony.xwork2.config.entities.PackageConfig;
 import com.opensymphony.xwork2.config.impl.DefaultConfiguration;
+import com.opensymphony.xwork2.inject.Container;
 import junit.framework.TestCase;
 import org.apache.struts2.dispatcher.mapper.ActionMapping;
 import org.springframework.mock.web.MockHttpServletRequest;
@@ -50,7 +51,7 @@ public class RestActionMapperTest extends TestCase {
         PackageConfig pkg2 = new PackageConfig.Builder("my").namespace("/my").build();
         config.addPackageConfig("mvns", pkg);
         config.addPackageConfig("my", pkg2);
-        configManager = new ConfigurationManager() {
+        configManager = new ConfigurationManager(Container.DEFAULT_NAME) {
             public Configuration getConfiguration() {
                 return config;
             }

http://git-wip-us.apache.org/repos/asf/struts/blob/6c19875c/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/StrutsConfigRetriever.java
----------------------------------------------------------------------
diff --git a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/StrutsConfigRetriever.java b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/StrutsConfigRetriever.java
index 1e6b245..8e70109 100644
--- a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/StrutsConfigRetriever.java
+++ b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/StrutsConfigRetriever.java
@@ -25,6 +25,7 @@ import com.opensymphony.xwork2.config.ConfigurationManager;
 import com.opensymphony.xwork2.config.ConfigurationProvider;
 import com.opensymphony.xwork2.config.entities.ActionConfig;
 import com.opensymphony.xwork2.config.entities.ResultConfig;
+import com.opensymphony.xwork2.inject.Container;
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.LogManager;
 import org.apache.struts2.config.DefaultBeanSelectionProvider;
@@ -71,7 +72,7 @@ public class StrutsConfigRetriever {
         File configFile = new File(configFilePath);
         try {
             ConfigurationProvider configProvider = new StrutsXmlConfigurationProvider(configFile.getCanonicalPath(), true, null);
-            cm = new ConfigurationManager();
+            cm = new ConfigurationManager(Container.DEFAULT_NAME);
             cm.addContainerProvider(new DefaultPropertiesProvider());
             cm.addContainerProvider(new StrutsXmlConfigurationProvider("struts-default.xml", false, null));
             cm.addContainerProvider(configProvider);


[21/24] struts git commit: Renames LocalizedTextUtil into DefaultLocalizedTextProvider

Posted by lu...@apache.org.
Renames LocalizedTextUtil into DefaultLocalizedTextProvider


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

Branch: refs/heads/master
Commit: 008c28ac67cbd477abe4761de34610d6de7cfda0
Parents: c3416e8
Author: Lukasz Lenart <lu...@apache.org>
Authored: Tue Mar 14 09:50:13 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Tue Mar 14 09:50:13 2017 +0100

----------------------------------------------------------------------
 .../xwork2/DefaultLocaleProvider.java           |    4 +-
 .../xwork2/DefaultTextProvider.java             |    4 +-
 .../config/impl/DefaultConfiguration.java       |    2 +-
 .../providers/XWorkConfigurationProvider.java   |    4 +-
 .../util/DefaultLocalizedTextProvider.java      | 1040 ++++++++++++++++++
 .../xwork2/util/LocalizedTextUtil.java          | 1035 -----------------
 .../org/apache/struts2/components/Date.java     |    1 -
 .../org/apache/struts2/components/I18n.java     |    4 +-
 .../config/DefaultBeanSelectionProvider.java    |    3 -
 .../apache/struts2/dispatcher/Dispatcher.java   |    7 +-
 .../multipart/JakartaMultiPartRequest.java      |    1 -
 .../multipart/MultiPartRequestWrapper.java      |    2 -
 .../struts2/factory/StrutsActionProxy.java      |    1 -
 .../struts2/interceptor/I18nInterceptor.java    |    4 +-
 .../struts2/util/StrutsTestCaseHelper.java      |    4 +-
 .../org/apache/struts2/util/TokenHelper.java    |    1 -
 core/src/main/resources/struts-default.xml      |    2 +-
 .../xwork2/TextProviderSupportTest.java         |    2 -
 .../util/DefaultLocalizedTextProviderTest.java  |  267 +++++
 .../xwork2/util/LocalizedTextUtilTest.java      |  267 -----
 .../struts2/components/ComponentTest.java       |    1 -
 .../DefaultBeanSelectionProviderTest.java       |    3 -
 .../PropertiesConfigurationProviderTest.java    |    6 +-
 .../org/apache/struts2/config/SettingsTest.java |    1 -
 .../multipart/PellMultiPartRequest.java         |    2 -
 .../portlet/dispatcher/Jsr168Dispatcher.java    |    5 +-
 26 files changed, 1329 insertions(+), 1344 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/core/src/main/java/com/opensymphony/xwork2/DefaultLocaleProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/DefaultLocaleProvider.java b/core/src/main/java/com/opensymphony/xwork2/DefaultLocaleProvider.java
index 1d687bc..f28ef03 100644
--- a/core/src/main/java/com/opensymphony/xwork2/DefaultLocaleProvider.java
+++ b/core/src/main/java/com/opensymphony/xwork2/DefaultLocaleProvider.java
@@ -1,6 +1,6 @@
 package com.opensymphony.xwork2;
 
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
+import com.opensymphony.xwork2.util.DefaultLocalizedTextProvider;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
@@ -26,7 +26,7 @@ public class DefaultLocaleProvider implements LocaleProvider {
 
     @Override
     public boolean isValidLocaleString(String localeStr) {
-        return isValidLocale(LocalizedTextUtil.localeFromString(localeStr, getLocale()));
+        return isValidLocale(DefaultLocalizedTextProvider.localeFromString(localeStr, getLocale()));
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/core/src/main/java/com/opensymphony/xwork2/DefaultTextProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/DefaultTextProvider.java b/core/src/main/java/com/opensymphony/xwork2/DefaultTextProvider.java
index b82c42a..2c885a1 100644
--- a/core/src/main/java/com/opensymphony/xwork2/DefaultTextProvider.java
+++ b/core/src/main/java/com/opensymphony/xwork2/DefaultTextProvider.java
@@ -16,7 +16,7 @@
 package com.opensymphony.xwork2;
 
 import com.opensymphony.xwork2.inject.Inject;
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
+import com.opensymphony.xwork2.util.DefaultLocalizedTextProvider;
 import com.opensymphony.xwork2.util.ValueStack;
 
 import java.io.Serializable;
@@ -32,7 +32,7 @@ import java.util.ResourceBundle;
  *
  * @author Jason Carreira jcarreira@gmail.com
  * @author Rainer Hermanns
- * @see LocalizedTextUtil#addDefaultResourceBundle(String)
+ * @see DefaultLocalizedTextProvider#addDefaultResourceBundle(String)
  */
 public class DefaultTextProvider implements TextProvider, Serializable, Unchainable {
 

http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java b/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
index 937a561..358eb5c 100644
--- a/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
+++ b/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
@@ -245,7 +245,7 @@ public class DefaultConfiguration implements Configuration {
         builder.factory(ReflectionProvider.class, OgnlReflectionProvider.class, Scope.SINGLETON);
         builder.factory(ValueStackFactory.class, OgnlValueStackFactory.class, Scope.SINGLETON);
 
-        builder.factory(LocalizedTextProvider.class, LocalizedTextUtil.class, Scope.SINGLETON);
+        builder.factory(LocalizedTextProvider.class, DefaultLocalizedTextProvider.class, Scope.SINGLETON);
 
         builder.factory(XWorkConverter.class, Scope.SINGLETON);
         builder.factory(ConversionPropertiesProcessor.class, DefaultConversionPropertiesProcessor.class, Scope.SINGLETON);

http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java b/core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java
index 407a96d..853f50e 100644
--- a/core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java
+++ b/core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java
@@ -72,7 +72,7 @@ import com.opensymphony.xwork2.ognl.accessor.XWorkMapPropertyAccessor;
 import com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor;
 import com.opensymphony.xwork2.util.CompoundRoot;
 import com.opensymphony.xwork2.LocalizedTextProvider;
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
+import com.opensymphony.xwork2.util.DefaultLocalizedTextProvider;
 import com.opensymphony.xwork2.util.OgnlTextParser;
 import com.opensymphony.xwork2.util.PatternMatcher;
 import com.opensymphony.xwork2.util.TextParser;
@@ -182,7 +182,7 @@ public class XWorkConfigurationProvider implements ConfigurationProvider {
                 .factory(ActionValidatorManager.class, "no-annotations", DefaultActionValidatorManager.class, Scope.SINGLETON)
 
                 .factory(TextProviderFactory.class, Scope.SINGLETON)
-                .factory(LocalizedTextProvider.class, LocalizedTextUtil.class, Scope.SINGLETON)
+                .factory(LocalizedTextProvider.class, DefaultLocalizedTextProvider.class, Scope.SINGLETON)
                 .factory(TextProvider.class, "system", DefaultTextProvider.class, Scope.SINGLETON)
                 .factory(TextProvider.class, TextProviderSupport.class, Scope.SINGLETON)
 

http://git-wip-us.apache.org/repos/asf/struts/blob/008c28ac/core/src/main/java/com/opensymphony/xwork2/util/DefaultLocalizedTextProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/util/DefaultLocalizedTextProvider.java b/core/src/main/java/com/opensymphony/xwork2/util/DefaultLocalizedTextProvider.java
new file mode 100644
index 0000000..1e55fdd
--- /dev/null
+++ b/core/src/main/java/com/opensymphony/xwork2/util/DefaultLocalizedTextProvider.java
@@ -0,0 +1,1040 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.opensymphony.xwork2.util;
+
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.LocalizedTextProvider;
+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.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.beans.PropertyDescriptor;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.text.MessageFormat;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+
+/**
+ * Provides support for localization in XWork.
+ *
+ * <!-- START SNIPPET: searchorder -->
+ * <p>Resource bundles are searched in the following order:</p>
+ *
+ * <ol>
+ * <li>ActionClass.properties</li>
+ * <li>Interface.properties (every interface and sub-interface)</li>
+ * <li>BaseClass.properties (all the way to Object.properties)</li>
+ * <li>ModelDriven's model (if implements ModelDriven), for the model object repeat from 1</li>
+ * <li>package.properties (of the directory where class is located and every parent directory all the way to the root directory)</li>
+ * <li>search up the i18n message key hierarchy itself</li>
+ * <li>global resource properties</li>
+ * </ol>
+ *
+ * <!-- END SNIPPET: searchorder -->
+ *
+ * <!-- START SNIPPET: packagenote -->
+ * <p>To clarify #5, while traversing the package hierarchy, Struts 2 will look for a file package.properties:</p>
+ * com/<br>
+ * &nbsp; acme/<br>
+ * &nbsp; &nbsp; package.properties<br>
+ * &nbsp; &nbsp; actions/<br>
+ * &nbsp; &nbsp; &nbsp; package.properties<br>
+ * &nbsp; &nbsp; &nbsp; FooAction.java<br>
+ * &nbsp; &nbsp; &nbsp; FooAction.properties<br>
+ * <p>
+ * If FooAction.properties does not exist, com/acme/action/package.properties will be searched for, if
+ * not found com/acme/package.properties, if not found com/package.properties, etc.
+ * </p>
+ * <!-- END SNIPPET: packagenote -->
+ *
+ * <!-- START SNIPPET: globalresource -->
+ * <p>
+ * A global resource bundle could be specified programmatically, as well as the locale.
+ * </p>
+ * <!-- END SNIPPET: globalresource -->
+ *
+ * @author Jason Carreira
+ * @author Mark Woon
+ * @author Rainer Hermanns
+ * @author tm_jee
+ */
+public class DefaultLocalizedTextProvider implements LocalizedTextProvider {
+
+    private static final Logger LOG = LogManager.getLogger(DefaultLocalizedTextProvider.class);
+
+    public static final String XWORK_MESSAGES_BUNDLE = "com/opensymphony/xwork2/xwork-messages";
+    public static final String STRUTS_MESSAGES_BUNDLE = "org/apache/struts2/struts-messages";
+
+    private static final String TOMCAT_RESOURCE_ENTRIES_FIELD = "resourceEntries";
+
+    private final ConcurrentMap<Integer, List<String>> classLoaderMap = new ConcurrentHashMap<>();
+
+    private boolean reloadBundles = false;
+    private boolean devMode = false;
+
+    private final ConcurrentMap<String, ResourceBundle> bundlesMap = new ConcurrentHashMap<>();
+    private final ConcurrentMap<MessageFormatKey, MessageFormat> messageFormats = new ConcurrentHashMap<>();
+    private final ConcurrentMap<Integer, ClassLoader> delegatedClassLoaderMap = new ConcurrentHashMap<>();
+    private final Set<String> missingBundles = Collections.synchronizedSet(new HashSet<String>());
+
+    private final String RELOADED = "com.opensymphony.xwork2.util.LocalizedTextUtil.reloaded";
+
+
+    /**
+     * Clears the internal list of resource bundles.
+     *
+     * @deprecated used only in tests
+     */
+    @Deprecated
+    public static void clearDefaultResourceBundles() {
+        // no-op
+    }
+
+    public DefaultLocalizedTextProvider() {
+
+        addDefaultResourceBundle(XWORK_MESSAGES_BUNDLE);
+        addDefaultResourceBundle(STRUTS_MESSAGES_BUNDLE);
+    }
+
+    /**
+     * Should resorce bundles be reloaded.
+     *
+     * @param reloadBundles reload bundles?
+     */
+    @Inject(value = StrutsConstants.STRUTS_I18N_RELOAD, required = false)
+    public void setReloadBundles(String reloadBundles) {
+        this.reloadBundles = Boolean.parseBoolean(reloadBundles);
+    }
+
+    @Inject(value = StrutsConstants.STRUTS_DEVMODE, required = false)
+    public void setDevMode(String devMode) {
+        this.devMode = Boolean.parseBoolean(devMode);
+    }
+
+    @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);
+                }
+            }
+        }
+    }
+
+    /**
+     * Add's the bundle to the internal list of default bundles.
+     * <p>
+     * If the bundle already exists in the list it will be readded.
+     * </p>
+     *
+     * @param resourceBundleName the name of the bundle to add.
+     */
+    @Override
+    public void addDefaultResourceBundle(String resourceBundleName) {
+        //make sure this doesn't get added more than once
+        final ClassLoader ccl = getCurrentThreadContextClassLoader();
+        synchronized (XWORK_MESSAGES_BUNDLE) {
+            List<String> bundles = classLoaderMap.get(ccl.hashCode());
+            if (bundles == null) {
+                bundles = new CopyOnWriteArrayList<>();
+                classLoaderMap.put(ccl.hashCode(), bundles);
+            }
+            bundles.remove(resourceBundleName);
+            bundles.add(0, resourceBundleName);
+        }
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Added default resource bundle '{}' to default resource bundles for the following classloader '{}'", resourceBundleName, ccl.toString());
+        }
+    }
+
+    /**
+     * 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
+     * {@link java.util.Locale#toString()}.
+     *
+     * @param localeStr     The locale String to parse.
+     * @param defaultLocale The locale to use if localeStr is <tt>null</tt>.
+     * @return requested Locale
+     */
+    public static Locale localeFromString(String localeStr, Locale defaultLocale) {
+        if ((localeStr == null) || (localeStr.trim().length() == 0) || ("_".equals(localeStr))) {
+            if (defaultLocale != null) {
+                return defaultLocale;
+            }
+            return Locale.getDefault();
+        }
+
+        int index = localeStr.indexOf('_');
+        if (index < 0) {
+            return new Locale(localeStr);
+        }
+
+        String language = localeStr.substring(0, index);
+        if (index == localeStr.length()) {
+            return new Locale(language);
+        }
+
+        localeStr = localeStr.substring(index + 1);
+        index = localeStr.indexOf('_');
+        if (index < 0) {
+            return new Locale(language, localeStr);
+        }
+
+        String country = localeStr.substring(0, index);
+        if (index == localeStr.length()) {
+            return new Locale(language, country);
+        }
+
+        localeStr = localeStr.substring(index + 1);
+        return new Locale(language, country, localeStr);
+    }
+
+    /**
+     * Returns a localized message for the specified key, aTextName.  Neither the key nor the
+     * message is evaluated.
+     *
+     * @param aTextName the message key
+     * @param locale    the locale the message should be for
+     * @return a localized message based on the specified key, or null if no localized message can be found for it
+     */
+    @Override
+    public String findDefaultText(String aTextName, Locale locale) {
+        List<String> localList = classLoaderMap.get(Thread.currentThread().getContextClassLoader().hashCode());
+
+        for (String bundleName : localList) {
+            ResourceBundle bundle = findResourceBundle(bundleName, locale);
+            if (bundle != null) {
+                reloadBundles();
+                try {
+                    return bundle.getString(aTextName);
+                } catch (MissingResourceException e) {
+                	// will be logged when not found in any bundle
+                }
+            }
+        }
+
+        if (devMode) {
+            LOG.warn("Missing key [{}] in bundles [{}]!", aTextName, localList);
+        } else {
+            LOG.debug("Missing key [{}] in bundles [{}]!", aTextName, localList);
+        }
+
+        return null;
+    }
+
+    /**
+     * Returns a localized message for the specified key, aTextName, substituting variables from the
+     * array of params into the message.  Neither the key nor the message is evaluated.
+     *
+     * @param aTextName the message key
+     * @param locale    the locale the message should be for
+     * @param params    an array of objects to be substituted into the message text
+     * @return A formatted message based on the specified key, or null if no localized message can be found for it
+     */
+    @Override
+    public String findDefaultText(String aTextName, Locale locale, Object[] params) {
+        String defaultText = findDefaultText(aTextName, locale);
+        if (defaultText != null) {
+            MessageFormat mf = buildMessageFormat(defaultText, locale);
+            return formatWithNullDetection(mf, params);
+        }
+        return null;
+    }
+
+    /**
+     * Finds the given resource bundle by it's name.
+     * <p>
+     * Will use <code>Thread.currentThread().getContextClassLoader()</code> as the classloader.
+     * </p>
+     *
+     * @param aBundleName the name of the bundle (usually it's FQN classname).
+     * @param locale      the locale.
+     * @return the bundle, <tt>null</tt> if not found.
+     */
+    @Override
+    public ResourceBundle findResourceBundle(String aBundleName, Locale locale) {
+        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)) {
+                bundle = bundlesMap.get(key);
+            } else {
+                bundle = ResourceBundle.getBundle(aBundleName, locale, classLoader);
+                bundlesMap.putIfAbsent(key, bundle);
+            }
+        } catch (MissingResourceException ex) {
+            if (delegatedClassLoaderMap.containsKey(classLoader.hashCode())) {
+                try {
+                    if (bundlesMap.containsKey(key)) {
+                        bundle = bundlesMap.get(key);
+                    } else {
+                        bundle = ResourceBundle.getBundle(aBundleName, locale, delegatedClassLoaderMap.get(classLoader.hashCode()));
+                        bundlesMap.putIfAbsent(key, bundle);
+                    }
+                } catch (MissingResourceException e) {
+                    LOG.debug("Missing resource bundle [{}]!", aBundleName, e);
+                    missingBundles.add(key);
+                }
+            } else {
+                LOG.debug("Missing resource bundle [{}]!", aBundleName);
+                missingBundles.add(key);
+            }
+        }
+        return bundle;
+    }
+
+    /**
+     * @param classLoader a {@link ClassLoader} to look up the bundle from if none can be found on the current thread's classloader
+     */
+    public void setDelegatedClassLoader(final ClassLoader classLoader) {
+        synchronized (bundlesMap) {
+            delegatedClassLoaderMap.put(getCurrentThreadContextClassLoader().hashCode(), classLoader);
+        }
+    }
+
+    /**
+     * @param bundleName Removes the bundle from any cached "misses"
+     */
+    public void clearBundle(final String bundleName) {
+        bundlesMap.remove(getCurrentThreadContextClassLoader().hashCode() + bundleName);
+    }
+
+
+    /**
+     * Creates a key to used for lookup/storing in the bundle misses cache.
+     *
+     * @param prefix      the prefix for the returning String - it is supposed to be the ClassLoader hash code.
+     * @param aBundleName the name of the bundle (usually it's FQN classname).
+     * @param locale      the locale.
+     * @return the key to use for lookup/storing in the bundle misses cache.
+     */
+    private String createMissesKey(String prefix, String aBundleName, Locale locale) {
+        return prefix + aBundleName + "_" + locale.toString();
+    }
+
+    /**
+     * Calls {@link #findText(Class aClass, String aTextName, Locale locale, String defaultMessage, Object[] args)}
+     * with aTextName as the default message.
+     *
+     * @param aClass class name
+     * @param aTextName  text name
+     * @param locale the locale
+     *
+     * @return the localized text, or null if none can be found and no defaultMessage is provided
+     * @see #findText(Class aClass, String aTextName, Locale locale, String defaultMessage, Object[] args)
+     */
+    @Override
+    public String findText(Class aClass, String aTextName, Locale locale) {
+        return findText(aClass, aTextName, locale, aTextName, new Object[0]);
+    }
+
+    /**
+     * <p>
+     * Finds a localized text message for the given key, aTextName. Both the key and the message
+     * itself is evaluated as required.  The following algorithm is used to find the requested
+     * message:
+     * </p>
+     *
+     * <ol>
+     * <li>Look for message in aClass' class hierarchy.
+     * <ol>
+     * <li>Look for the message in a resource bundle for aClass</li>
+     * <li>If not found, look for the message in a resource bundle for any implemented interface</li>
+     * <li>If not found, traverse up the Class' hierarchy and repeat from the first sub-step</li>
+     * </ol></li>
+     * <li>If not found and aClass is a {@link ModelDriven} Action, then look for message in
+     * the model's class hierarchy (repeat sub-steps listed above).</li>
+     * <li>If not found, look for message in child property.  This is determined by evaluating
+     * the message key as an OGNL expression.  For example, if the key is
+     * <i>user.address.state</i>, then it will attempt to see if "user" can be resolved into an
+     * object.  If so, repeat the entire process fromthe beginning with the object's class as
+     * aClass and "address.state" as the message key.</li>
+     * <li>If not found, look for the message in aClass' package hierarchy.</li>
+     * <li>If still not found, look for the message in the default resource bundles.</li>
+     * <li>Return defaultMessage</li>
+     * </ol>
+     *
+     * <p>
+     * When looking for the message, if the key indexes a collection (e.g. user.phone[0]) and a
+     * message for that specific key cannot be found, the general form will also be looked up
+     * (i.e. user.phone[*]).
+     * </p>
+     *
+     * <p>
+     * If a message is found, it will also be interpolated.  Anything within <code>${...}</code>
+     * will be treated as an OGNL expression and evaluated as such.
+     * </p>
+     *
+     * @param aClass         the class whose name to use as the start point for the search
+     * @param aTextName      the key to find the text message for
+     * @param locale         the locale the message should be for
+     * @param defaultMessage the message to be returned if no text message can be found in any
+     *                       resource bundle
+     * @param args           arguments
+     *                       resource bundle
+     * @return the localized text, or null if none can be found and no defaultMessage is provided
+     */
+    @Override
+    public String findText(Class aClass, String aTextName, Locale locale, String defaultMessage, Object[] args) {
+        ValueStack valueStack = ActionContext.getContext().getValueStack();
+        return findText(aClass, aTextName, locale, defaultMessage, args, valueStack);
+
+    }
+
+    /**
+     * <p>
+     * Finds a localized text message for the given key, aTextName. Both the key and the message
+     * itself is evaluated as required.  The following algorithm is used to find the requested
+     * message:
+     * </p>
+     *
+     * <ol>
+     * <li>Look for message in aClass' class hierarchy.
+     * <ol>
+     * <li>Look for the message in a resource bundle for aClass</li>
+     * <li>If not found, look for the message in a resource bundle for any implemented interface</li>
+     * <li>If not found, traverse up the Class' hierarchy and repeat from the first sub-step</li>
+     * </ol></li>
+     * <li>If not found and aClass is a {@link ModelDriven} Action, then look for message in
+     * the model's class hierarchy (repeat sub-steps listed above).</li>
+     * <li>If not found, look for message in child property.  This is determined by evaluating
+     * the message key as an OGNL expression.  For example, if the key is
+     * <i>user.address.state</i>, then it will attempt to see if "user" can be resolved into an
+     * object.  If so, repeat the entire process fromthe beginning with the object's class as
+     * aClass and "address.state" as the message key.</li>
+     * <li>If not found, look for the message in aClass' package hierarchy.</li>
+     * <li>If still not found, look for the message in the default resource bundles.</li>
+     * <li>Return defaultMessage</li>
+     * </ol>
+     *
+     * <p>
+     * When looking for the message, if the key indexes a collection (e.g. user.phone[0]) and a
+     * message for that specific key cannot be found, the general form will also be looked up
+     * (i.e. user.phone[*]).
+     * </p>
+     *
+     * <p>
+     * If a message is found, it will also be interpolated.  Anything within <code>${...}</code>
+     * will be treated as an OGNL expression and evaluated as such.
+     * </p>
+     *
+     * <p>
+     * If a message is <b>not</b> found a WARN log will be logged.
+     * </p>
+     *
+     * @param aClass         the class whose name to use as the start point for the search
+     * @param aTextName      the key to find the text message for
+     * @param locale         the locale the message should be for
+     * @param defaultMessage the message to be returned if no text message can be found in any
+     *                       resource bundle
+     * @param args           arguments
+     * @param valueStack     the value stack to use to evaluate expressions instead of the
+     *                       one in the ActionContext ThreadLocal
+     * @return the localized text, or null if none can be found and no defaultMessage is provided
+     */
+    @Override
+    public String findText(Class aClass, String aTextName, Locale locale, String defaultMessage, Object[] args,
+                           ValueStack valueStack) {
+        String indexedTextName = null;
+        if (aTextName == null) {
+        	LOG.warn("Trying to find text with null key!");
+            aTextName = "";
+        }
+        // calculate indexedTextName (collection[*]) if applicable
+        if (aTextName.contains("[")) {
+            int i = -1;
+
+            indexedTextName = aTextName;
+
+            while ((i = indexedTextName.indexOf("[", i + 1)) != -1) {
+                int j = indexedTextName.indexOf("]", i);
+                String a = indexedTextName.substring(0, i);
+                String b = indexedTextName.substring(j);
+                indexedTextName = a + "[*" + b;
+            }
+        }
+
+        // search up class hierarchy
+        String msg = findMessage(aClass, aTextName, indexedTextName, locale, args, null, valueStack);
+
+        if (msg != null) {
+            return msg;
+        }
+
+        if (ModelDriven.class.isAssignableFrom(aClass)) {
+            ActionContext context = ActionContext.getContext();
+            // search up model's class hierarchy
+            ActionInvocation actionInvocation = context.getActionInvocation();
+
+            // ActionInvocation may be null if we're being run from a Sitemesh filter, so we won't get model texts if this is null
+            if (actionInvocation != null) {
+                Object action = actionInvocation.getAction();
+                if (action instanceof ModelDriven) {
+                    Object model = ((ModelDriven) action).getModel();
+                    if (model != null) {
+                        msg = findMessage(model.getClass(), aTextName, indexedTextName, locale, args, null, valueStack);
+                        if (msg != null) {
+                            return msg;
+                        }
+                    }
+                }
+            }
+        }
+
+        // nothing still? alright, search the package hierarchy now
+        for (Class clazz = aClass;
+             (clazz != null) && !clazz.equals(Object.class);
+             clazz = clazz.getSuperclass()) {
+
+            String basePackageName = clazz.getName();
+            while (basePackageName.lastIndexOf('.') != -1) {
+                basePackageName = basePackageName.substring(0, basePackageName.lastIndexOf('.'));
+                String packageName = basePackageName + ".package";
+                msg = getMessage(packageName, locale, aTextName, valueStack, args);
+
+                if (msg != null) {
+                    return msg;
+                }
+
+                if (indexedTextName != null) {
+                    msg = getMessage(packageName, locale, indexedTextName, valueStack, args);
+
+                    if (msg != null) {
+                        return msg;
+                    }
+                }
+            }
+        }
+
+        // see if it's a child property
+        int idx = aTextName.indexOf(".");
+
+        if (idx != -1) {
+            String newKey = null;
+            String prop = null;
+
+            if (aTextName.startsWith(XWorkConverter.CONVERSION_ERROR_PROPERTY_PREFIX)) {
+                idx = aTextName.indexOf(".", XWorkConverter.CONVERSION_ERROR_PROPERTY_PREFIX.length());
+
+                if (idx != -1) {
+                    prop = aTextName.substring(XWorkConverter.CONVERSION_ERROR_PROPERTY_PREFIX.length(), idx);
+                    newKey = XWorkConverter.CONVERSION_ERROR_PROPERTY_PREFIX + aTextName.substring(idx + 1);
+                }
+            } else {
+                prop = aTextName.substring(0, idx);
+                newKey = aTextName.substring(idx + 1);
+            }
+
+            if (prop != null) {
+                Object obj = valueStack.findValue(prop);
+                try {
+                    Object actionObj = ReflectionProviderFactory.getInstance().getRealTarget(prop, valueStack.getContext(), valueStack.getRoot());
+                    if (actionObj != null) {
+                        PropertyDescriptor propertyDescriptor = ReflectionProviderFactory.getInstance().getPropertyDescriptor(actionObj.getClass(), prop);
+
+                        if (propertyDescriptor != null) {
+                            Class clazz = propertyDescriptor.getPropertyType();
+
+                            if (clazz != null) {
+                                if (obj != null) {
+                                    valueStack.push(obj);
+                                }
+                                msg = findText(clazz, newKey, locale, null, args);
+                                if (obj != null) {
+                                    valueStack.pop();
+                                }
+                                if (msg != null) {
+                                    return msg;
+                                }
+                            }
+                        }
+                    }
+                } catch (Exception e) {
+                    LOG.debug("unable to find property {}", prop, e);
+                }
+            }
+        }
+
+        // get default
+        GetDefaultMessageReturnArg result;
+        if (indexedTextName == null) {
+            result = getDefaultMessage(aTextName, locale, valueStack, args, defaultMessage);
+        } else {
+            result = getDefaultMessage(aTextName, locale, valueStack, args, null);
+            if (result != null && result.message != null) {
+                return result.message;
+            }
+            result = getDefaultMessage(indexedTextName, locale, valueStack, args, defaultMessage);
+        }
+
+        // could we find the text, if not log a warn
+        if (unableToFindTextForKey(result) && LOG.isDebugEnabled()) {
+            String warn = "Unable to find text for key '" + aTextName + "' ";
+            if (indexedTextName != null) {
+                warn += " or indexed key '" + indexedTextName + "' ";
+            }
+            warn += "in class '" + aClass.getName() + "' and locale '" + locale + "'";
+            LOG.debug(warn);
+        }
+
+        return result != null ? result.message : null;
+    }
+
+    /**
+     * Determines if we found the text in the bundles.
+     *
+     * @param result the result so far
+     * @return <tt>true</tt> if we could <b>not</b> find the text, <tt>false</tt> if the text was found (=success).
+     */
+    private static boolean unableToFindTextForKey(GetDefaultMessageReturnArg result) {
+        if (result == null || result.message == null) {
+            return true;
+        }
+
+        // did we find it in the bundle, then no problem?
+        if (result.foundInBundle) {
+            return false;
+        }
+
+        // not found in bundle
+        return true;
+    }
+
+    /**
+     * <p>
+     * Finds a localized text message for the given key, aTextName, in the specified resource bundle
+     * with aTextName as the default message.
+     * </p>
+     *
+     * <p>
+     * If a message is found, it will also be interpolated.  Anything within <code>${...}</code>
+     * will be treated as an OGNL expression and evaluated as such.
+     * </p>
+     *
+     * @param bundle a resource bundle name
+     * @param aTextName  text name
+     * @param locale the locale
+     *
+     * @return the localized text, or null if none can be found and no defaultMessage is provided
+     * @see #findText(java.util.ResourceBundle, String, java.util.Locale, String, Object[])
+     */
+    @Override
+    public String findText(ResourceBundle bundle, String aTextName, Locale locale) {
+        return findText(bundle, aTextName, locale, aTextName, new Object[0]);
+    }
+
+    /**
+     * <p>
+     * Finds a localized text message for the given key, aTextName, in the specified resource
+     * bundle.
+     * </p>
+     *
+     * <p>
+     * If a message is found, it will also be interpolated.  Anything within <code>${...}</code>
+     * will be treated as an OGNL expression and evaluated as such.
+     * </p>
+     *
+     * <p>
+     * If a message is <b>not</b> found a WARN log will be logged.
+     * </p>
+     *
+     * @param bundle         the bundle
+     * @param aTextName      the key
+     * @param locale         the locale
+     * @param defaultMessage the default message to use if no message was found in the bundle
+     * @param args           arguments for the message formatter.
+     * @return the localized text, or null if none can be found and no defaultMessage is provided
+     */
+    @Override
+    public String findText(ResourceBundle bundle, String aTextName, Locale locale, String defaultMessage, Object[] args) {
+        ValueStack valueStack = ActionContext.getContext().getValueStack();
+        return findText(bundle, aTextName, locale, defaultMessage, args, valueStack);
+    }
+
+    /**
+     * <p>
+     * Finds a localized text message for the given key, aTextName, in the specified resource
+     * bundle.
+     * </p>
+     *
+     * <p>
+     * If a message is found, it will also be interpolated.  Anything within <code>${...}</code>
+     * will be treated as an OGNL expression and evaluated as such.
+     * </p>
+     *
+     * <p>
+     * If a message is <b>not</b> found a WARN log will be logged.
+     * </p>
+     *
+     * @param bundle         the bundle
+     * @param aTextName      the key
+     * @param locale         the locale
+     * @param defaultMessage the default message to use if no message was found in the bundle
+     * @param args           arguments for the message formatter.
+     * @param valueStack     the OGNL value stack.
+     * @return the localized text, or null if none can be found and no defaultMessage is provided
+     */
+    @Override
+    public String findText(ResourceBundle bundle, String aTextName, Locale locale, String defaultMessage, Object[] args,
+                           ValueStack valueStack) {
+        try {
+            reloadBundles(valueStack.getContext());
+
+            String message = TextParseUtil.translateVariables(bundle.getString(aTextName), valueStack);
+            MessageFormat mf = buildMessageFormat(message, locale);
+
+            return formatWithNullDetection(mf, args);
+        } catch (MissingResourceException ex) {
+            if (devMode) {
+                LOG.warn("Missing key [{}] in bundle [{}]!", aTextName, bundle);
+            } else {
+                LOG.debug("Missing key [{}] in bundle [{}]!", aTextName, bundle);
+            }
+        }
+
+        GetDefaultMessageReturnArg result = getDefaultMessage(aTextName, locale, valueStack, args, defaultMessage);
+        if (unableToFindTextForKey(result)) {
+            LOG.warn("Unable to find text for key '{}' in ResourceBundles for locale '{}'", aTextName, locale);
+        }
+        return result != null ? result.message : null;
+    }
+
+    /**
+     * @return the default message.
+     */
+    private GetDefaultMessageReturnArg getDefaultMessage(String key, Locale locale, ValueStack valueStack, Object[] args,
+                                                                String defaultMessage) {
+        GetDefaultMessageReturnArg result = null;
+        boolean found = true;
+
+        if (key != null) {
+            String message = findDefaultText(key, locale);
+
+            if (message == null) {
+                message = defaultMessage;
+                found = false; // not found in bundles
+            }
+
+            // defaultMessage may be null
+            if (message != null) {
+                MessageFormat mf = buildMessageFormat(TextParseUtil.translateVariables(message, valueStack), locale);
+
+                String msg = formatWithNullDetection(mf, args);
+                result = new GetDefaultMessageReturnArg(msg, found);
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * @return the message from the named resource bundle.
+     */
+    private String getMessage(String bundleName, Locale locale, String key, ValueStack valueStack, Object[] args) {
+        ResourceBundle bundle = findResourceBundle(bundleName, locale);
+        if (bundle == null) {
+            return null;
+        }
+        if (valueStack != null) 
+            reloadBundles(valueStack.getContext());
+        try {
+        	String message = bundle.getString(key);
+        	if (valueStack != null) 
+        		message = TextParseUtil.translateVariables(bundle.getString(key), valueStack);
+            MessageFormat mf = buildMessageFormat(message, locale);
+            return formatWithNullDetection(mf, args);
+        } catch (MissingResourceException e) {
+            if (devMode) {
+                LOG.warn("Missing key [{}] in bundle [{}]!", key, bundleName);
+            } else {
+                LOG.debug("Missing key [{}] in bundle [{}]!", key, bundleName);
+            }
+            return null;
+        }
+    }
+
+    private String formatWithNullDetection(MessageFormat mf, Object[] args) {
+        String message = mf.format(args);
+        if ("null".equals(message)) {
+            return null;
+        } else {
+            return message;
+        }
+    }
+
+    private MessageFormat buildMessageFormat(String pattern, Locale locale) {
+        MessageFormatKey key = new MessageFormatKey(pattern, locale);
+        MessageFormat format = messageFormats.get(key);
+        if (format == null) {
+            format = new MessageFormat(pattern);
+            format.setLocale(locale);
+            format.applyPattern(pattern);
+            messageFormats.put(key, format);
+        }
+
+        return format;
+    }
+
+    /**
+     * Traverse up class hierarchy looking for message.  Looks at class, then implemented interface,
+     * before going up hierarchy.
+     *
+     * @return the message
+     */
+    private String findMessage(Class clazz, String key, String indexedKey, Locale locale, Object[] args, Set<String> checked,
+                                      ValueStack valueStack) {
+        if (checked == null) {
+            checked = new TreeSet<String>();
+        } else if (checked.contains(clazz.getName())) {
+            return null;
+        }
+
+        // look in properties of this class
+        String msg = getMessage(clazz.getName(), locale, key, valueStack, args);
+
+        if (msg != null) {
+            return msg;
+        }
+
+        if (indexedKey != null) {
+            msg = getMessage(clazz.getName(), locale, indexedKey, valueStack, args);
+
+            if (msg != null) {
+                return msg;
+            }
+        }
+
+        // look in properties of implemented interfaces
+        Class[] interfaces = clazz.getInterfaces();
+
+        for (Class anInterface : interfaces) {
+            msg = getMessage(anInterface.getName(), locale, key, valueStack, args);
+
+            if (msg != null) {
+                return msg;
+            }
+
+            if (indexedKey != null) {
+                msg = getMessage(anInterface.getName(), locale, indexedKey, valueStack, args);
+
+                if (msg != null) {
+                    return msg;
+                }
+            }
+        }
+
+        // traverse up hierarchy
+        if (clazz.isInterface()) {
+            interfaces = clazz.getInterfaces();
+
+            for (Class anInterface : interfaces) {
+                msg = findMessage(anInterface, key, indexedKey, locale, args, checked, valueStack);
+
+                if (msg != null) {
+                    return msg;
+                }
+            }
+        } else {
+            if (!clazz.equals(Object.class) && !clazz.isPrimitive()) {
+                return findMessage(clazz.getSuperclass(), key, indexedKey, locale, args, checked, valueStack);
+            }
+        }
+
+        return null;
+    }
+
+    private void reloadBundles() {
+        reloadBundles(ActionContext.getContext() != null ? ActionContext.getContext().getContextMap() : null);
+    }
+
+    private void reloadBundles(Map<String, Object> context) {
+        if (reloadBundles) {
+            try {
+                Boolean reloaded;
+                if (context != null) {
+                    reloaded = (Boolean) ObjectUtils.defaultIfNull(context.get(RELOADED), Boolean.FALSE);
+                }else {
+                    reloaded = Boolean.FALSE;
+                }
+                if (!reloaded) {
+                    bundlesMap.clear();
+                    try {
+                        clearMap(ResourceBundle.class, null, "cacheList");
+                    } catch (NoSuchFieldException e) {
+                        // happens in IBM JVM, that has a different ResourceBundle impl
+                        // it has a 'cache' member
+                        clearMap(ResourceBundle.class, null, "cache");
+                    }
+
+                    // now, for the true and utter hack, if we're running in tomcat, clear
+                    // it's class loader resource cache as well.
+                    clearTomcatCache();
+                    if(context!=null) {
+                        context.put(RELOADED, true);
+                    }
+                    LOG.debug("Resource bundles reloaded");
+                }
+            } catch (Exception e) {
+                LOG.error("Could not reload resource bundles", e);
+            }
+        }
+    }
+
+
+    private static void clearTomcatCache() {
+        ClassLoader loader = getCurrentThreadContextClassLoader();
+        // no need for compilation here.
+        Class cl = loader.getClass();
+
+        try {
+            if ("org.apache.catalina.loader.WebappClassLoader".equals(cl.getName())) {
+                clearMap(cl, loader, TOMCAT_RESOURCE_ENTRIES_FIELD);
+            } else {
+                LOG.debug("Class loader {} is not tomcat loader.", cl.getName());
+            }
+        } catch (NoSuchFieldException nsfe) {
+            if ("org.apache.catalina.loader.WebappClassLoaderBase".equals(cl.getSuperclass().getName())) {
+                LOG.debug("Base class {} doesn't contain '{}' field, trying with parent!", cl.getName(), TOMCAT_RESOURCE_ENTRIES_FIELD, nsfe);
+                try {
+                    clearMap(cl.getSuperclass(), loader, TOMCAT_RESOURCE_ENTRIES_FIELD);
+                } catch (Exception e) {
+                    LOG.warn("Couldn't clear tomcat cache using {}", cl.getSuperclass().getName(), e);
+                }
+            }
+        } catch (Exception e) {
+      	    LOG.warn("Couldn't clear tomcat cache", cl.getName(), e);
+        }
+    }
+
+
+    private static void clearMap(Class cl, Object obj, String name)
+            throws NoSuchFieldException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
+
+        Field field = cl.getDeclaredField(name);
+        field.setAccessible(true);
+
+        Object cache = field.get(obj);
+
+        synchronized (cache) {
+            Class ccl = cache.getClass();
+            Method clearMethod = ccl.getMethod("clear");
+            clearMethod.invoke(cache);
+        }
+    }
+
+    /**
+     * Clears all the internal lists.
+     *
+     * @deprecated used only in tests
+     */
+    @Override
+    @Deprecated
+    public void reset() {
+        // no-op
+    }
+
+    static class MessageFormatKey {
+        String pattern;
+        Locale locale;
+
+        MessageFormatKey(String pattern, Locale locale) {
+            this.pattern = pattern;
+            this.locale = locale;
+        }
+
+        @Override
+        public boolean equals(Object o) {
+            if (this == o) return true;
+            if (!(o instanceof MessageFormatKey)) return false;
+
+            final MessageFormatKey messageFormatKey = (MessageFormatKey) o;
+
+            if (locale != null ? !locale.equals(messageFormatKey.locale) : messageFormatKey.locale != null)
+                return false;
+            if (pattern != null ? !pattern.equals(messageFormatKey.pattern) : messageFormatKey.pattern != null)
+                return false;
+
+            return true;
+        }
+
+        @Override
+        public int hashCode() {
+            int result;
+            result = (pattern != null ? pattern.hashCode() : 0);
+            result = 29 * result + (locale != null ? locale.hashCode() : 0);
+            return result;
+        }
+    }
+
+    private static ClassLoader getCurrentThreadContextClassLoader() {
+        return Thread.currentThread().getContextClassLoader();
+    }
+
+    static class GetDefaultMessageReturnArg {
+        String message;
+        boolean foundInBundle;
+
+        public GetDefaultMessageReturnArg(String message, boolean foundInBundle) {
+            this.message = message;
+            this.foundInBundle = foundInBundle;
+        }
+    }
+
+    private static class EmptyResourceBundle extends ResourceBundle {
+        @Override
+        public Enumeration<String> getKeys() {
+            return null; // dummy
+        }
+
+        @Override
+        protected Object handleGetObject(String key) {
+            return null; // dummy
+        }
+    }
+
+}


[24/24] struts git commit: Uses proper setter name

Posted by lu...@apache.org.
Uses proper setter name


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

Branch: refs/heads/master
Commit: 6ee73dce79df5bf2a13e24ce33380c8ec415d236
Parents: fefb91f
Author: Lukasz Lenart <lu...@apache.org>
Authored: Tue Mar 14 10:14:03 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Tue Mar 14 10:14:03 2017 +0100

----------------------------------------------------------------------
 core/src/main/java/com/opensymphony/xwork2/DefaultActionProxy.java | 2 +-
 .../src/main/java/com/opensymphony/xwork2/DefaultTextProvider.java | 2 +-
 .../src/main/java/com/opensymphony/xwork2/TextProviderFactory.java | 2 +-
 .../src/main/java/com/opensymphony/xwork2/TextProviderSupport.java | 2 +-
 .../java/com/opensymphony/xwork2/interceptor/AliasInterceptor.java | 2 +-
 .../xwork2/interceptor/StaticParametersInterceptor.java            | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/6ee73dce/core/src/main/java/com/opensymphony/xwork2/DefaultActionProxy.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/DefaultActionProxy.java b/core/src/main/java/com/opensymphony/xwork2/DefaultActionProxy.java
index 1ab012c..87838bc 100644
--- a/core/src/main/java/com/opensymphony/xwork2/DefaultActionProxy.java
+++ b/core/src/main/java/com/opensymphony/xwork2/DefaultActionProxy.java
@@ -115,7 +115,7 @@ public class DefaultActionProxy implements ActionProxy, Serializable {
     }
 
     @Inject
-    public void setLocalizedTextUtil(LocalizedTextProvider localizedTextProvider) {
+    public void setLocalizedTextProvider(LocalizedTextProvider localizedTextProvider) {
         this.localizedTextProvider = localizedTextProvider;
     }
 

http://git-wip-us.apache.org/repos/asf/struts/blob/6ee73dce/core/src/main/java/com/opensymphony/xwork2/DefaultTextProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/DefaultTextProvider.java b/core/src/main/java/com/opensymphony/xwork2/DefaultTextProvider.java
index 2c885a1..51ed449 100644
--- a/core/src/main/java/com/opensymphony/xwork2/DefaultTextProvider.java
+++ b/core/src/main/java/com/opensymphony/xwork2/DefaultTextProvider.java
@@ -44,7 +44,7 @@ public class DefaultTextProvider implements TextProvider, Serializable, Unchaina
     }
 
     @Inject
-    public void setLocalizedTextUtil(LocalizedTextProvider localizedTextProvider) {
+    public void setLocalizedTextProvider(LocalizedTextProvider localizedTextProvider) {
         this.localizedTextProvider = localizedTextProvider;
     }
 

http://git-wip-us.apache.org/repos/asf/struts/blob/6ee73dce/core/src/main/java/com/opensymphony/xwork2/TextProviderFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/TextProviderFactory.java b/core/src/main/java/com/opensymphony/xwork2/TextProviderFactory.java
index 91b110c..349d876 100644
--- a/core/src/main/java/com/opensymphony/xwork2/TextProviderFactory.java
+++ b/core/src/main/java/com/opensymphony/xwork2/TextProviderFactory.java
@@ -42,7 +42,7 @@ public class TextProviderFactory {
     }
 
     @Inject
-    public void setLocalizedTextUtil(LocalizedTextProvider localizedTextProvider) {
+    public void setLocalizedTextProvider(LocalizedTextProvider localizedTextProvider) {
         this.localizedTextProvider = localizedTextProvider;
     }
 

http://git-wip-us.apache.org/repos/asf/struts/blob/6ee73dce/core/src/main/java/com/opensymphony/xwork2/TextProviderSupport.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/TextProviderSupport.java b/core/src/main/java/com/opensymphony/xwork2/TextProviderSupport.java
index b576751..cf177d3 100644
--- a/core/src/main/java/com/opensymphony/xwork2/TextProviderSupport.java
+++ b/core/src/main/java/com/opensymphony/xwork2/TextProviderSupport.java
@@ -88,7 +88,7 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
     }
 
     @Inject
-    public void setLocalizedTextUtil(LocalizedTextProvider localizedTextProvider) {
+    public void setLocalizedTextProvider(LocalizedTextProvider localizedTextProvider) {
         this.localizedTextProvider = localizedTextProvider;
     }
 

http://git-wip-us.apache.org/repos/asf/struts/blob/6ee73dce/core/src/main/java/com/opensymphony/xwork2/interceptor/AliasInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/AliasInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/AliasInterceptor.java
index f3f9c00..b82b773 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/AliasInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/AliasInterceptor.java
@@ -108,7 +108,7 @@ public class AliasInterceptor extends AbstractInterceptor {
     }
 
     @Inject
-    public void setLocalizedTextUtil(LocalizedTextProvider localizedTextProvider) {
+    public void setLocalizedTextProvider(LocalizedTextProvider localizedTextProvider) {
         this.localizedTextProvider = localizedTextProvider;
     }
 

http://git-wip-us.apache.org/repos/asf/struts/blob/6ee73dce/core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java
index 1453583..e4eaa47 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java
@@ -106,7 +106,7 @@ public class StaticParametersInterceptor extends AbstractInterceptor {
     }
 
     @Inject
-    public void setLocalizedTextUtil(LocalizedTextProvider localizedTextProvider) {
+    public void setLocalizedTextProvider(LocalizedTextProvider localizedTextProvider) {
         this.localizedTextProvider = localizedTextProvider;
     }
 


[17/24] struts git commit: Fixes small typos

Posted by lu...@apache.org.
Fixes small typos


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

Branch: refs/heads/master
Commit: 31ddb8b6020b2d67c0e5a7ad11d9d3a8b0fbdbf9
Parents: f784a16
Author: Lukasz Lenart <lu...@apache.org>
Authored: Mon Mar 13 09:24:55 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Mon Mar 13 09:24:55 2017 +0100

----------------------------------------------------------------------
 .../com/opensymphony/xwork2/util/LocalizedTextUtilTest.java    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/31ddb8b6/core/src/test/java/com/opensymphony/xwork2/util/LocalizedTextUtilTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/util/LocalizedTextUtilTest.java b/core/src/test/java/com/opensymphony/xwork2/util/LocalizedTextUtilTest.java
index e8dc982..6631815 100644
--- a/core/src/test/java/com/opensymphony/xwork2/util/LocalizedTextUtilTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/util/LocalizedTextUtilTest.java
@@ -200,7 +200,7 @@ public class LocalizedTextUtilTest extends XWorkTestCase {
     }
 
     public void testLocalizedDateFormatIsUsed() throws ParseException {
-        localizedTextUtil.addDefaultResourceBundle("com/opensymphony/xwork2/util/localizedTextUtilTest");
+        LocalizedTextUtil.addDefaultResourceBundle("com/opensymphony/xwork2/util/LocalizedTextUtilTest");
         Date date = DateFormat.getDateInstance(DateFormat.SHORT, Locale.US).parse("01/01/2015");
         Object[] params = new Object[]{ date };
         String usDate = localizedTextUtil.findDefaultText("test.format.date", Locale.US, params);
@@ -210,7 +210,7 @@ public class LocalizedTextUtilTest extends XWorkTestCase {
     }
 
     public void testXW377() {
-        localizedTextUtil.addDefaultResourceBundle("com/opensymphony/xwork2/util/localizedTextUtilTest");
+        LocalizedTextUtil.addDefaultResourceBundle("com/opensymphony/xwork2/util/LocalizedTextUtilTest");
 
         String text = localizedTextUtil.findText(Bar.class, "xw377", ActionContext.getContext().getLocale(), "xw377", null, ActionContext.getContext().getValueStack());
         assertEquals("xw377", text); // should not log
@@ -261,7 +261,7 @@ public class LocalizedTextUtilTest extends XWorkTestCase {
     @Override
     protected void tearDown() throws Exception {
         super.tearDown();
-        localizedTextUtil.clearDefaultResourceBundles();
+        LocalizedTextUtil.clearDefaultResourceBundles();
     }
 
 }


[02/24] struts git commit: Defines LocalizedTextUtil as a bean

Posted by lu...@apache.org.
Defines LocalizedTextUtil as a bean


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

Branch: refs/heads/master
Commit: ae09c6a0878ea3beac58567b58cfbdea261f4945
Parents: b3b8b90
Author: Lukasz Lenart <lu...@apache.org>
Authored: Wed Mar 8 17:41:42 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Wed Mar 8 17:41:42 2017 +0100

----------------------------------------------------------------------
 core/src/main/resources/struts-default.xml | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/ae09c6a0/core/src/main/resources/struts-default.xml
----------------------------------------------------------------------
diff --git a/core/src/main/resources/struts-default.xml b/core/src/main/resources/struts-default.xml
index 26c89ea..d8e80f1 100644
--- a/core/src/main/resources/struts-default.xml
+++ b/core/src/main/resources/struts-default.xml
@@ -130,6 +130,7 @@
     <bean type="com.opensymphony.xwork2.conversion.impl.NumberConverter" name="struts" class="com.opensymphony.xwork2.conversion.impl.NumberConverter" scope="singleton"/>
     <bean type="com.opensymphony.xwork2.conversion.impl.StringConverter" name="struts" class="com.opensymphony.xwork2.conversion.impl.StringConverter" scope="singleton"/>
 
+    <bean type="com.opensymphony.xwork2.util.LocalizedTextUtil" name="struts" class="com.opensymphony.xwork2.util.LocalizedTextUtil" scope="singleton" />
     <bean type="com.opensymphony.xwork2.TextProvider" name="struts" class="com.opensymphony.xwork2.TextProviderSupport" scope="prototype" />
     <bean type="com.opensymphony.xwork2.LocaleProvider" name="struts" class="com.opensymphony.xwork2.DefaultLocaleProvider" scope="singleton" />