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 2024/11/02 22:53:16 UTC

(struts) branch feature/WW-5481-text created (now 026c992c0)

This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a change to branch feature/WW-5481-text
in repository https://gitbox.apache.org/repos/asf/struts.git


      at 026c992c0 WW-5481 Extracts duplicated code

This branch includes the following new commits:

     new dc62488bc WW-5481 Moves text related classes into org.apache.struts2.text
     new 026c992c0 WW-5481 Extracts duplicated code

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(struts) 02/02: WW-5481 Extracts duplicated code

Posted by lu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch feature/WW-5481-text
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 026c992c083e21382121780760d48fd8ab20a6d5
Author: Lukasz Lenart <lu...@apache.org>
AuthorDate: Sat Nov 2 23:53:02 2024 +0100

    WW-5481 Extracts duplicated code
---
 .../text/AbstractLocalizedTextProvider.java        | 131 +++++-------
 .../struts2/text/GlobalLocalizedTextProvider.java  | 170 ++-------------
 .../apache/struts2/text/LocalizedTextProvider.java | 164 ++++++++++++++-
 .../struts2/text/StrutsLocalizedTextProvider.java  | 234 +++------------------
 4 files changed, 253 insertions(+), 446 deletions(-)

diff --git a/core/src/main/java/org/apache/struts2/text/AbstractLocalizedTextProvider.java b/core/src/main/java/org/apache/struts2/text/AbstractLocalizedTextProvider.java
index e7683cd6c..6185552c1 100644
--- a/core/src/main/java/org/apache/struts2/text/AbstractLocalizedTextProvider.java
+++ b/core/src/main/java/org/apache/struts2/text/AbstractLocalizedTextProvider.java
@@ -67,24 +67,18 @@ abstract class AbstractLocalizedTextProvider implements LocalizedTextProvider {
     private final Set<String> missingBundles = ConcurrentHashMap.newKeySet();
     private final ConcurrentMap<Integer, ClassLoader> delegatedClassLoaderMap = new ConcurrentHashMap<>();
 
-    /**
-     * Adds the bundle to the internal list of default bundles.
-     * If the bundle already exists in the list it will be re-added.
-     *
-     * @param resourceBundleName the name of the bundle to add.
-     */
     @Override
-    public void addDefaultResourceBundle(String resourceBundleName) {
+    public void addDefaultResourceBundle(String bundleName) {
         //make sure this doesn't get added more than once
         final ClassLoader ccl = getCurrentThreadContextClassLoader();
         synchronized (XWORK_MESSAGES_BUNDLE) {
             List<String> bundles = classLoaderMap.computeIfAbsent(ccl.hashCode(), k -> new CopyOnWriteArrayList<>());
-            bundles.remove(resourceBundleName);
-            bundles.add(0, resourceBundleName);
+            bundles.remove(bundleName);
+            bundles.add(0, bundleName);
         }
 
         if (LOG.isDebugEnabled()) {
-            LOG.debug("Added default resource bundle '{}' to default resource bundles for the following classloader '{}'", resourceBundleName, ccl.toString());
+            LOG.debug("Added default resource bundle '{}' to default resource bundles for the following classloader '{}'", bundleName, ccl.toString());
         }
     }
 
@@ -113,16 +107,8 @@ abstract class AbstractLocalizedTextProvider implements LocalizedTextProvider {
         }
     }
 
-    /**
-     * 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) {
+    public String findDefaultText(String textKey, Locale locale) {
         List<String> localList = getCurrentBundleNames();
 
         for (String bundleName : localList) {
@@ -130,7 +116,7 @@ abstract class AbstractLocalizedTextProvider implements LocalizedTextProvider {
             if (bundle != null) {
                 reloadBundles();
                 try {
-                    return bundle.getString(aTextName);
+                    return bundle.getString(textKey);
                 } catch (MissingResourceException e) {
                     // will be logged when not found in any bundle
                 }
@@ -138,26 +124,17 @@ abstract class AbstractLocalizedTextProvider implements LocalizedTextProvider {
         }
 
         if (devMode) {
-            LOG.warn("Missing key [{}] in bundles [{}]!", aTextName, localList);
+            LOG.warn("Missing key [{}] in bundles [{}]!", textKey, localList);
         } else {
-            LOG.debug("Missing key [{}] in bundles [{}]!", aTextName, localList);
+            LOG.debug("Missing key [{}] in bundles [{}]!", textKey, 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);
+    public String findDefaultText(String textKey, Locale locale, Object[] params) {
+        String defaultText = findDefaultText(textKey, locale);
         if (defaultText != null) {
             MessageFormat mf = buildMessageFormat(defaultText, locale);
             return formatWithNullDetection(mf, params);
@@ -165,51 +142,27 @@ abstract class AbstractLocalizedTextProvider implements LocalizedTextProvider {
         return null;
     }
 
-
-    /**
-     * <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,
+    public String findText(ResourceBundle bundle, String textKey, Locale locale, String defaultMessage, Object[] args,
                            ValueStack valueStack) {
         try {
             reloadBundles(valueStack.getContext());
 
-            String message = TextParseUtil.translateVariables(bundle.getString(aTextName), valueStack);
+            String message = TextParseUtil.translateVariables(bundle.getString(textKey), valueStack);
             MessageFormat mf = buildMessageFormat(message, locale);
 
             return formatWithNullDetection(mf, args);
         } catch (MissingResourceException ex) {
             if (devMode) {
-                LOG.warn("Missing key [{}] in bundle [{}]!", aTextName, bundle);
+                LOG.warn("Missing key [{}] in bundle [{}]!", textKey, bundle);
             } else {
-                LOG.debug("Missing key [{}] in bundle [{}]!", aTextName, bundle);
+                LOG.debug("Missing key [{}] in bundle [{}]!", textKey, bundle);
             }
         }
 
-        GetDefaultMessageReturnArg result = getDefaultMessage(aTextName, locale, valueStack, args, defaultMessage);
+        GetDefaultMessageReturnArg result = getDefaultMessage(textKey, locale, valueStack, args, defaultMessage);
         if (unableToFindTextForKey(result)) {
-            LOG.warn("Unable to find text for key '{}' in ResourceBundles for locale '{}'", aTextName, locale);
+            LOG.warn("Unable to find text for key '{}' in ResourceBundles for locale '{}'", textKey, locale);
         }
         return result != null ? result.message : null;
     }
@@ -425,20 +378,10 @@ abstract class AbstractLocalizedTextProvider implements LocalizedTextProvider {
         this.searchDefaultBundlesFirst = Boolean.parseBoolean(searchDefaultBundlesFirst);
     }
 
-    /**
-     * 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) {
+    public ResourceBundle findResourceBundle(String bundleName, Locale locale) {
         ClassLoader classLoader = getCurrentThreadContextClassLoader();
-        String key = createMissesKey(String.valueOf(classLoader.hashCode()), aBundleName, locale);
+        String key = createMissesKey(String.valueOf(classLoader.hashCode()), bundleName, locale);
 
         if (missingBundles.contains(key)) {
             return null;
@@ -449,7 +392,7 @@ abstract class AbstractLocalizedTextProvider implements LocalizedTextProvider {
             if (bundlesMap.containsKey(key)) {
                 bundle = bundlesMap.get(key);
             } else {
-                bundle = ResourceBundle.getBundle(aBundleName, locale, classLoader);
+                bundle = ResourceBundle.getBundle(bundleName, locale, classLoader);
                 bundlesMap.putIfAbsent(key, bundle);
             }
         } catch (MissingResourceException ex) {
@@ -458,15 +401,15 @@ abstract class AbstractLocalizedTextProvider implements LocalizedTextProvider {
                     if (bundlesMap.containsKey(key)) {
                         bundle = bundlesMap.get(key);
                     } else {
-                        bundle = ResourceBundle.getBundle(aBundleName, locale, delegatedClassLoaderMap.get(classLoader.hashCode()));
+                        bundle = ResourceBundle.getBundle(bundleName, locale, delegatedClassLoaderMap.get(classLoader.hashCode()));
                         bundlesMap.putIfAbsent(key, bundle);
                     }
                 } catch (MissingResourceException e) {
-                    LOG.debug("Missing resource bundle [{}]!", aBundleName, e);
+                    LOG.debug("Missing resource bundle [{}]!", bundleName, e);
                     missingBundles.add(key);
                 }
             } else {
-                LOG.debug("Missing resource bundle [{}]!", aBundleName);
+                LOG.debug("Missing resource bundle [{}]!", bundleName);
                 missingBundles.add(key);
             }
         }
@@ -656,6 +599,36 @@ abstract class AbstractLocalizedTextProvider implements LocalizedTextProvider {
         return null;
     }
 
+    protected String extractIndexedName(String textKey) {
+        String indexedTextName = null;
+        // calculate indexedTextName (collection[*]) if applicable
+        if (textKey.contains("[")) {
+            int i = -1;
+
+            indexedTextName = textKey;
+
+            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;
+            }
+        }
+        return indexedTextName;
+    }
+
+    protected void logMissingText(Class<?> startClazz, String textKey, Locale locale, GetDefaultMessageReturnArg result, String indexedTextName) {
+        // could we find the text, if not log a WARN
+        if (unableToFindTextForKey(result) && LOG.isDebugEnabled()) {
+            String warn = "Unable to find text for key '" + textKey + "' ";
+            if (indexedTextName != null) {
+                warn += " or indexed key '" + indexedTextName + "' ";
+            }
+            warn += "in class '" + startClazz.getName() + "' and locale '" + locale + "'";
+            LOG.debug(warn);
+        }
+    }
+
     static class MessageFormatKey {
         String pattern;
         Locale locale;
diff --git a/core/src/main/java/org/apache/struts2/text/GlobalLocalizedTextProvider.java b/core/src/main/java/org/apache/struts2/text/GlobalLocalizedTextProvider.java
index 33ab693dd..31ea21650 100644
--- a/core/src/main/java/org/apache/struts2/text/GlobalLocalizedTextProvider.java
+++ b/core/src/main/java/org/apache/struts2/text/GlobalLocalizedTextProvider.java
@@ -41,182 +41,42 @@ public class GlobalLocalizedTextProvider extends AbstractLocalizedTextProvider {
         addDefaultResourceBundle(STRUTS_MESSAGES_BUNDLE);
     }
 
-    /**
-     * 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]);
+    public String findText(Class<?> startClazz, String textKey, Locale locale) {
+        return findText(startClazz, textKey, locale, textKey, 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 the message in the default resource bundles.</li>
-     * <li>If not found, 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) {
+    public String findText(Class<?> startClazz, String textKey, Locale locale, String defaultMessage, Object[] args) {
         ValueStack valueStack = ActionContext.getContext().getValueStack();
-        return findText(aClass, aTextName, locale, defaultMessage, args, valueStack);
-
+        return findText(startClazz, textKey, 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 the message in the default resource bundles.</li>
-     * <li>If not found, 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 DEBUG level log warning 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;
-            }
+    public String findText(Class<?> startClazz, String textKey, Locale locale, String defaultMessage, Object[] args, ValueStack valueStack) {
+        if (textKey == null) {
+            LOG.debug("Key is null, short-circuit to default message");
+            return defaultMessage;
         }
+        String indexedTextName = extractIndexedName(textKey);
 
         // get default
-        GetDefaultMessageReturnArg result = getDefaultMessageWithAlternateKey(aTextName, indexedTextName, locale, valueStack, args, defaultMessage);
+        GetDefaultMessageReturnArg result = getDefaultMessageWithAlternateKey(textKey, 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);
-        }
+        logMissingText(startClazz, textKey, locale, result, indexedTextName);
 
         return result != null ? result.message : null;
     }
 
-    /**
-     * <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(ResourceBundle, String, Locale, String, Object[])
-     */
     @Override
-    public String findText(ResourceBundle bundle, String aTextName, Locale locale) {
-        return findText(bundle, aTextName, locale, aTextName, new Object[0]);
+    public String findText(ResourceBundle bundle, String textKey, Locale locale) {
+        return findText(bundle, textKey, locale, textKey, 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) {
+    public String findText(ResourceBundle bundle, String textKey, Locale locale, String defaultMessage, Object[] args) {
         ValueStack valueStack = ActionContext.getContext().getValueStack();
-        return findText(bundle, aTextName, locale, defaultMessage, args, valueStack);
+        return findText(bundle, textKey, locale, defaultMessage, args, valueStack);
     }
 
 }
diff --git a/core/src/main/java/org/apache/struts2/text/LocalizedTextProvider.java b/core/src/main/java/org/apache/struts2/text/LocalizedTextProvider.java
index fcaf39975..472ab35f4 100644
--- a/core/src/main/java/org/apache/struts2/text/LocalizedTextProvider.java
+++ b/core/src/main/java/org/apache/struts2/text/LocalizedTextProvider.java
@@ -26,24 +26,168 @@ import java.util.ResourceBundle;
 
 public interface LocalizedTextProvider extends Serializable {
 
-    String findDefaultText(String aTextName, Locale locale);
+    /**
+     * Returns a localized message for the specified key, aTextName.  Neither the key nor the
+     * message is evaluated.
+     *
+     * @param textKey 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
+     */
+    String findDefaultText(String textKey, Locale locale);
 
-    String findDefaultText(String aTextName, Locale locale, Object[] params);
+    /**
+     * 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 textKey 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
+     */
+    String findDefaultText(String textKey, Locale locale, Object[] params);
 
-    ResourceBundle findResourceBundle(String aBundleName, Locale locale);
+    /**
+     * Finds the given resource bundle by it's name.
+     * <p>
+     * Will use <code>Thread.currentThread().getContextClassLoader()</code> as the classloader.
+     * </p>
+     *
+     * @param bundleName the name of the bundle (usually it's FQN classname).
+     * @param locale     the locale.
+     * @return the bundle, <tt>null</tt> if not found.
+     */
+    ResourceBundle findResourceBundle(String bundleName, Locale locale);
 
-    String findText(Class<?> aClass, String aTextName, Locale locale);
+    /**
+     * Calls {@link #findText(Class startClazz, String textKey, Locale locale, String defaultMessage, Object[] args)}
+     * with textKey as the default message.
+     *
+     * @param startClazz class name
+     * @param textKey    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 startClazz, String textKey, Locale locale, String defaultMessage, Object[] args)
+     */
+    String findText(Class<?> startClazz, String textKey, Locale locale);
 
-    String findText(Class<?> aClass, String aTextName, Locale locale, String defaultMessage, Object[] args);
+    /**
+     * Finds a localized text message for the given key, textKey. Both the key and the message
+     * itself is evaluated as required.  The following algorithm is used to find the requested
+     * message:
+     *
+     * <ol>
+     * <li>Look for the message in the default resource bundles.</li>
+     * <li>If not found, 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>
+     * 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.
+     *
+     * @param startClazz     the class whose name to use as the start point for the search
+     * @param textKey        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
+     */
+    String findText(Class<?> startClazz, String textKey, Locale locale, String defaultMessage, Object[] args);
 
-    String findText(Class<?> aClass, String aTextName, Locale locale, String defaultMessage, Object[] args, ValueStack valueStack);
+    /**
+     * Finds a localized text message for the given key, textKey. Both the key and the message
+     * itself is evaluated as required.  The following algorithm is used to find the requested
+     * message:
+     *
+     * <ol>
+     * <li>Look for the message in the default resource bundles.</li>
+     * <li>If not found, 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>
+     * 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>
+     * If a message is <b>not</b> found a DEBUG level log warning will be logged.
+     *
+     * @param startClazz     the class whose name to use as the start point for the search
+     * @param textKey        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
+     */
+    String findText(Class<?> startClazz, String textKey, Locale locale, String defaultMessage, Object[] args, ValueStack valueStack);
 
-    String findText(ResourceBundle bundle, String aTextName, Locale locale);
+    /**
+     * Finds a localized text message for the given key, aTextName, in the specified resource bundle
+     * with aTextName as the default message.
+     * <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.
+     *
+     * @param bundle  a resource bundle name
+     * @param textKey text name
+     * @param locale  the locale
+     * @return the localized text, or null if none can be found and no defaultMessage is provided
+     * @see #findText(ResourceBundle, String, Locale, String, Object[])
+     */
+    String findText(ResourceBundle bundle, String textKey, Locale locale);
 
-    String findText(ResourceBundle bundle, String aTextName, Locale locale, String defaultMessage, Object[] args);
+    /**
+     * Finds a localized text message for the given key, aTextName, in the specified resource
+     * bundle.
+     * <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>
+     * If a message is <b>not</b> found a WARN log will be logged.
+     *
+     * @param bundle         the bundle
+     * @param textKey        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
+     */
+    String findText(ResourceBundle bundle, String textKey, Locale locale, String defaultMessage, Object[] args);
 
-    String findText(ResourceBundle bundle, String aTextName, Locale locale, String defaultMessage, Object[] args, ValueStack valueStack);
+    /**
+     * Finds a localized text message for the given key, aTextName, in the specified resource
+     * bundle.
+     * <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>
+     * If a message is <b>not</b> found a WARN log will be logged.
+     *
+     * @param bundle         the bundle
+     * @param textKey        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
+     */
+    String findText(ResourceBundle bundle, String textKey, Locale locale, String defaultMessage, Object[] args, ValueStack valueStack);
 
-    void addDefaultResourceBundle(String resourceBundleName);
+    /**
+     * Adds the bundle to the internal list of default bundles.
+     * If the bundle already exists in the list it will be re-added.
+     *
+     * @param bundleName the name of the bundle to add.
+     */
+    void addDefaultResourceBundle(String bundleName);
 
 }
diff --git a/core/src/main/java/org/apache/struts2/text/StrutsLocalizedTextProvider.java b/core/src/main/java/org/apache/struts2/text/StrutsLocalizedTextProvider.java
index 3199d8a0f..bfdfe22fb 100644
--- a/core/src/main/java/org/apache/struts2/text/StrutsLocalizedTextProvider.java
+++ b/core/src/main/java/org/apache/struts2/text/StrutsLocalizedTextProvider.java
@@ -18,6 +18,8 @@
  */
 package org.apache.struts2.text;
 
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.struts2.ActionContext;
 import org.apache.struts2.ActionInvocation;
 import org.apache.struts2.ModelDriven;
@@ -25,8 +27,6 @@ import org.apache.struts2.conversion.impl.XWorkConverter;
 import org.apache.struts2.inject.Inject;
 import org.apache.struts2.util.ValueStack;
 import org.apache.struts2.util.reflection.ReflectionProvider;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 
 import java.beans.PropertyDescriptor;
 import java.util.Locale;
@@ -46,150 +46,26 @@ public class StrutsLocalizedTextProvider extends AbstractLocalizedTextProvider {
         addDefaultResourceBundle(STRUTS_MESSAGES_BUNDLE);
     }
 
-    /**
-     * 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]);
+    public String findText(Class<?> startClazz, String textKey, Locale locale) {
+        return findText(startClazz, textKey, locale, textKey, 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>If {@link #searchDefaultBundlesFirst} is <code>true</code>, look for the message in the default resource bundles first.</li>
-     * <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 from the 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
-     * (Note: the lookup is not repeated again if {@link #searchDefaultBundlesFirst} was <code>true</code>).</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) {
+    public String findText(Class<?> startClazz, String textKey, Locale locale, String defaultMessage, Object[] args) {
         ValueStack valueStack = ActionContext.getContext().getValueStack();
-        return findText(aClass, aTextName, locale, defaultMessage, args, valueStack);
+        return findText(startClazz, textKey, 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>If {@link #searchDefaultBundlesFirst} is <code>true</code>, look for the message in the default resource bundles first.</li>
-     * <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 from the 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
-     * (Note: the lookup is not repeated again if {@link #searchDefaultBundlesFirst} was <code>true</code>).</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 DEBUG level log warning 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,
+    public String findText(Class<?> startClazz, String textKey, 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;
-            }
+        if (textKey == null) {
+            LOG.debug("Key is null, short-circuit to default message");
+            return defaultMessage;
         }
+        String indexedTextName = extractIndexedName(textKey);
 
         // Allow for and track an early lookup for the message in the default resource bundles first, before searching the class hierarchy.
         // The early lookup is only performed when the text provider has been configured to do so, otherwise follow the standard processing order.
@@ -198,21 +74,21 @@ public class StrutsLocalizedTextProvider extends AbstractLocalizedTextProvider {
 
         // If search default bundles first is set true, call alternative logic first.
         if (searchDefaultBundlesFirst) {
-            result = getDefaultMessageWithAlternateKey(aTextName, indexedTextName, locale, valueStack, args, defaultMessage);
+            result = getDefaultMessageWithAlternateKey(textKey, indexedTextName, locale, valueStack, args, defaultMessage);
             performedInitialDefaultBundlesMessageLookup = true;
             if (!unableToFindTextForKey(result)) {
-                return result.message;  // Found a message in the default resource bundles for aTextName or indexedTextName.
+                return result.message;  // Found a message in the default resource bundles for textKey or indexedTextName.
             }
         }
 
         // search up class hierarchy
-        String msg = findMessage(aClass, aTextName, indexedTextName, locale, args, null, valueStack);
+        String msg = findMessage(startClazz, textKey, indexedTextName, locale, args, null, valueStack);
 
         if (msg != null) {
             return msg;
         }
 
-        if (ModelDriven.class.isAssignableFrom(aClass)) {
+        if (ModelDriven.class.isAssignableFrom(startClazz)) {
             ActionContext context = ActionContext.getContext();
             // search up model's class hierarchy
             ActionInvocation actionInvocation = context.getActionInvocation();
@@ -223,7 +99,7 @@ public class StrutsLocalizedTextProvider extends AbstractLocalizedTextProvider {
                 if (action instanceof ModelDriven) {
                     Object model = ((ModelDriven<?>) action).getModel();
                     if (model != null) {
-                        msg = findMessage(model.getClass(), aTextName, indexedTextName, locale, args, null, valueStack);
+                        msg = findMessage(model.getClass(), textKey, indexedTextName, locale, args, null, valueStack);
                         if (msg != null) {
                             return msg;
                         }
@@ -233,7 +109,7 @@ public class StrutsLocalizedTextProvider extends AbstractLocalizedTextProvider {
         }
 
         // nothing still? alright, search the package hierarchy now
-        for (Class<?> clazz = aClass;
+        for (Class<?> clazz = startClazz;
              (clazz != null) && !clazz.equals(Object.class);
              clazz = clazz.getSuperclass()) {
 
@@ -241,7 +117,7 @@ public class StrutsLocalizedTextProvider extends AbstractLocalizedTextProvider {
             while (basePackageName.lastIndexOf('.') != -1) {
                 basePackageName = basePackageName.substring(0, basePackageName.lastIndexOf('.'));
                 String packageName = basePackageName + ".package";
-                msg = getMessage(packageName, locale, aTextName, valueStack, args);
+                msg = getMessage(packageName, locale, textKey, valueStack, args);
 
                 if (msg != null) {
                     return msg;
@@ -258,22 +134,22 @@ public class StrutsLocalizedTextProvider extends AbstractLocalizedTextProvider {
         }
 
         // see if it's a child property
-        int idx = aTextName.indexOf('.');
+        int idx = textKey.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 (textKey.startsWith(XWorkConverter.CONVERSION_ERROR_PROPERTY_PREFIX)) {
+                idx = textKey.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);
+                    prop = textKey.substring(XWorkConverter.CONVERSION_ERROR_PROPERTY_PREFIX.length(), idx);
+                    newKey = XWorkConverter.CONVERSION_ERROR_PROPERTY_PREFIX + textKey.substring(idx + 1);
                 }
             } else {
-                prop = aTextName.substring(0, idx);
-                newKey = aTextName.substring(idx + 1);
+                prop = textKey.substring(0, idx);
+                newKey = textKey.substring(idx + 1);
             }
 
             if (prop != null) {
@@ -310,74 +186,28 @@ public class StrutsLocalizedTextProvider extends AbstractLocalizedTextProvider {
         // Note: The default bundles lookup may already have been performed (via alternate early lookup),
         //       so we check first to avoid repeating the same operation twice.
         if (!performedInitialDefaultBundlesMessageLookup) {
-            result = getDefaultMessageWithAlternateKey(aTextName, indexedTextName, locale, valueStack, args, defaultMessage);
+            result = getDefaultMessageWithAlternateKey(textKey, 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);
-        }
+        logMissingText(startClazz, textKey, locale, result, indexedTextName);
 
         return result != null ? result.message : null;
     }
 
-    /**
-     * <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]);
+    public String findText(ResourceBundle bundle, String textKey, Locale locale) {
+        return findText(bundle, textKey, locale, textKey, 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) {
+    public String findText(ResourceBundle bundle, String textKey, Locale locale, String defaultMessage, Object[] args) {
         ValueStack valueStack = ActionContext.getContext().getValueStack();
-        return findText(bundle, aTextName, locale, defaultMessage, args, valueStack);
+        return findText(bundle, textKey, locale, defaultMessage, args, valueStack);
     }
 
     @Inject
     public void setReflectionProvider(ReflectionProvider reflectionProvider) {
         this.reflectionProvider = reflectionProvider;
     }
+
 }


(struts) 01/02: WW-5481 Moves text related classes into org.apache.struts2.text

Posted by lu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch feature/WW-5481-text
in repository https://gitbox.apache.org/repos/asf/struts.git

commit dc62488bc01c5bcdd5bfc0503001b39b281da52c
Author: Lukasz Lenart <lu...@apache.org>
AuthorDate: Sat Nov 2 23:31:07 2024 +0100

    WW-5481 Moves text related classes into org.apache.struts2.text
---
 .../java/org/apache/struts2/ActionSupport.java     |   2 +
 .../org/apache/struts2/DefaultActionProxy.java     |   1 +
 .../java/org/apache/struts2/LocaleProvider.java    |   5 +-
 .../java/org/apache/struts2/components/Date.java   |   2 +-
 .../java/org/apache/struts2/components/I18n.java   |   6 +-
 .../config/StrutsBeanSelectionProvider.java        |   6 +-
 .../struts2/config/impl/DefaultConfiguration.java  |  12 +--
 .../struts2/conversion/impl/DateConverter.java     |   2 +-
 .../struts2/conversion/impl/XWorkConverter.java    |   2 +-
 .../interceptor/AbstractFileUploadInterceptor.java |   6 +-
 .../struts2/interceptor/AliasInterceptor.java      |   2 +-
 .../interceptor/StaticParametersInterceptor.java   |   2 +-
 .../struts2/interceptor/TokenInterceptor.java      |   6 +-
 .../org/apache/struts2/ognl/OgnlValueStack.java    |   2 +-
 .../apache/struts2/ognl/OgnlValueStackFactory.java |   2 +-
 .../AbstractLocalizedTextProvider.java             |  89 +++++++++--------
 .../struts2/{ => text}/CompositeTextProvider.java  |   2 +-
 .../struts2/{ => text}/DefaultTextProvider.java    |   4 +-
 .../GlobalLocalizedTextProvider.java               |  13 +--
 .../struts2/{ => text}/LocalizedTextProvider.java  |   8 +-
 .../{ => text}/ResourceBundleTextProvider.java     |   6 +-
 .../StrutsLocalizedTextProvider.java               |  15 +--
 .../{ => text}/StrutsTextProviderFactory.java      |   5 +-
 .../apache/struts2/{ => text}/TextProvider.java    |   8 +-
 .../struts2/{ => text}/TextProviderFactory.java    |   4 +-
 .../struts2/{ => text}/TextProviderSupport.java    |  66 ++++++------
 .../java/org/apache/struts2/util/DebugUtils.java   |   2 +-
 .../apache/struts2/util/TextProviderHelper.java    |   3 +-
 .../java/org/apache/struts2/util/TokenHelper.java  |   2 +-
 .../validator/DefaultActionValidatorManager.java   |   2 +-
 .../validator/DelegatingValidatorContext.java      |   6 +-
 .../apache/struts2/validator/ValidatorContext.java |   2 +-
 .../validator/validators/ValidatorSupport.java     |   2 +-
 .../validators/VisitorFieldValidator.java          |   4 +-
 core/src/main/resources/struts-beans.xml           |  14 +--
 .../java/org/apache/struts2/ActionSupportTest.java |   1 +
 .../java/org/apache/struts2/LocaleAwareTest.java   |   1 +
 .../java/org/apache/struts2/ModelDrivenAction.java |   2 +-
 .../java/org/apache/struts2/ObjectFactoryTest.java |   1 +
 .../apache/struts2/components/ComponentTest.java   |   2 +-
 .../org/apache/struts2/config/SettingsTest.java    |   2 +-
 .../config/StrutsBeanSelectionProviderTest.java    |   3 +-
 .../ConfigurationProviderOgnlAllowlistTest.java    |   6 +-
 .../struts2/conversion/impl/DateConverterTest.java |   2 +-
 .../conversion/impl/XWorkBasicConverterTest.java   |   2 +-
 .../conversion/impl/XWorkConverterTest.java        |   4 +-
 .../apache/struts2/dispatcher/DispatcherTest.java  |   2 +-
 .../parameter/ParametersInterceptorTest.java       |   2 +-
 .../org/apache/struts2/mock/DummyTextProvider.java |   2 +-
 .../org/apache/struts2/mock/InjectableAction.java  |   2 +-
 .../java/org/apache/struts2/ognl/OgnlUtilTest.java |   2 +-
 .../apache/struts2/ognl/OgnlValueStackTest.java    |   2 +-
 .../apache/struts2/test/ModelDrivenAction2.java    |   1 -
 .../{ => text}/CompositeTextProviderTest.java      |  46 +++++----
 .../{ => text}/DefaultTextProviderTest.java        |  32 +++---
 .../StrutsLocalizedTextProviderTest.java           | 111 ++++++++++-----------
 .../struts2/{ => text}/StubTextProvider.java       |   2 +-
 .../{ => text}/TextProviderSupportTest.java        |  33 +++---
 .../AnnotationActionValidatorManagerTest.java      |   2 +-
 .../ConversionErrorFieldValidatorTest.java         |   2 +-
 .../validator/DoubleRangeFieldValidatorTest.java   |   2 +-
 .../struts2/validator/DummyValidatorContext.java   |   2 +-
 .../struts2/validator/EmailValidatorTest.java      |   2 +-
 .../struts2/validator/ExpressionValidatorTest.java |   2 +-
 .../struts2/validator/RegexFieldValidatorTest.java |   3 +-
 ...teConversionErrorFieldValidatorSupportTest.java |   2 +-
 .../validator/SimpleActionValidationTest.java      |   4 +-
 .../validator/StringLengthFieldValidatorTest.java  |   2 +-
 .../struts2/validator/StringValidatorTest.java     |   2 +-
 .../apache/struts2/validator/URLValidatorTest.java |   2 +-
 .../validators/AppendingValidatorContextTest.java  |   6 +-
 .../validators/CreditCardValidatorTest.java        |   2 +-
 .../validators/DateRangeFieldValidatorTest.java    |   2 +-
 .../validators/IntRangeFieldValidatorTest.java     |   2 +-
 .../validators/LongRangeFieldValidatorTest.java    |   2 +-
 .../validators/RequiredFieldValidatorTest.java     |   2 +-
 .../validators/RequiredStringValidatorTest.java    |   2 +-
 .../validators/ShortRangeFieldValidatorTest.java   |   2 +-
 .../DefaultTextProviderTest_en_CA.properties       |   0
 .../TextProviderSupportTest_en.properties          |   0
 .../interceptor/BeanValidationInterceptor.java     |   2 +-
 .../org/apache/struts2/mock/DummyTextProvider.java |   2 +-
 .../struts2/spring/SpringObjectFactoryTest.java    |   2 +-
 .../struts2/tiles/I18NAttributeEvaluator.java      |   4 +-
 84 files changed, 309 insertions(+), 326 deletions(-)

diff --git a/core/src/main/java/org/apache/struts2/ActionSupport.java b/core/src/main/java/org/apache/struts2/ActionSupport.java
index f5d58b091..6da71ae39 100644
--- a/core/src/main/java/org/apache/struts2/ActionSupport.java
+++ b/core/src/main/java/org/apache/struts2/ActionSupport.java
@@ -25,6 +25,8 @@ import org.apache.struts2.conversion.impl.ConversionData;
 import org.apache.struts2.inject.Container;
 import org.apache.struts2.inject.Inject;
 import org.apache.struts2.interceptor.ValidationAware;
+import org.apache.struts2.text.TextProvider;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.util.ValueStack;
 
 import java.io.Serializable;
diff --git a/core/src/main/java/org/apache/struts2/DefaultActionProxy.java b/core/src/main/java/org/apache/struts2/DefaultActionProxy.java
index 82a5da14b..43fb695ec 100644
--- a/core/src/main/java/org/apache/struts2/DefaultActionProxy.java
+++ b/core/src/main/java/org/apache/struts2/DefaultActionProxy.java
@@ -26,6 +26,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.text.StringEscapeUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
+import org.apache.struts2.text.LocalizedTextProvider;
 
 import java.io.Serial;
 import java.io.Serializable;
diff --git a/core/src/main/java/org/apache/struts2/LocaleProvider.java b/core/src/main/java/org/apache/struts2/LocaleProvider.java
index 0b502aa74..6536b62a3 100644
--- a/core/src/main/java/org/apache/struts2/LocaleProvider.java
+++ b/core/src/main/java/org/apache/struts2/LocaleProvider.java
@@ -23,15 +23,14 @@ import org.apache.commons.lang3.StringUtils;
 
 import java.util.Locale;
 
-
 /**
  * Indicates that the implementing class can provide its own {@link Locale}.
  *
  * <p>
  * This is useful for when an action may wish override the default locale. All that is
  * needed is to implement this interface and return your own custom locale.
- * The {@link TextProvider} interface uses this interface heavily for retrieving
- * internationalized messages from resource bundles.
+ * The {@link org.apache.struts2.text.TextProvider} interface uses this interface
+ * heavily for retrieving internationalized messages from resource bundles.
  * </p>
  *
  * @author Jason Carreira
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 08d84ab77..d00917858 100644
--- a/core/src/main/java/org/apache/struts2/components/Date.java
+++ b/core/src/main/java/org/apache/struts2/components/Date.java
@@ -18,7 +18,7 @@
  */
 package org.apache.struts2.components;
 
-import org.apache.struts2.TextProvider;
+import org.apache.struts2.text.TextProvider;
 import org.apache.struts2.inject.Inject;
 import org.apache.struts2.util.ValueStack;
 import org.apache.logging.log4j.LogManager;
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 44ff427df..d8ef748da 100644
--- a/core/src/main/java/org/apache/struts2/components/I18n.java
+++ b/core/src/main/java/org/apache/struts2/components/I18n.java
@@ -22,14 +22,14 @@ import java.io.Writer;
 import java.util.ResourceBundle;
 
 import org.apache.struts2.LocaleProviderFactory;
-import org.apache.struts2.LocalizedTextProvider;
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.LocalizedTextProvider;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.views.annotations.StrutsTag;
 import org.apache.struts2.views.annotations.StrutsTagAttribute;
 import org.apache.struts2.StrutsException;
 
 import org.apache.struts2.LocaleProvider;
-import org.apache.struts2.TextProvider;
+import org.apache.struts2.text.TextProvider;
 import org.apache.struts2.inject.Inject;
 import org.apache.struts2.util.ValueStack;
 import org.apache.logging.log4j.LogManager;
diff --git a/core/src/main/java/org/apache/struts2/config/StrutsBeanSelectionProvider.java b/core/src/main/java/org/apache/struts2/config/StrutsBeanSelectionProvider.java
index 16e1c7ca3..a31b35896 100644
--- a/core/src/main/java/org/apache/struts2/config/StrutsBeanSelectionProvider.java
+++ b/core/src/main/java/org/apache/struts2/config/StrutsBeanSelectionProvider.java
@@ -23,11 +23,11 @@ import org.apache.struts2.ActionProxyFactory;
 import org.apache.struts2.FileManager;
 import org.apache.struts2.FileManagerFactory;
 import org.apache.struts2.LocaleProviderFactory;
-import org.apache.struts2.LocalizedTextProvider;
+import org.apache.struts2.text.LocalizedTextProvider;
 import org.apache.struts2.ObjectFactory;
 import org.apache.struts2.StrutsConstants;
-import org.apache.struts2.TextProvider;
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProvider;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.UnknownHandlerManager;
 import org.apache.struts2.components.UrlRenderer;
 import org.apache.struts2.components.date.DateFormatter;
diff --git a/core/src/main/java/org/apache/struts2/config/impl/DefaultConfiguration.java b/core/src/main/java/org/apache/struts2/config/impl/DefaultConfiguration.java
index 3ea854b21..0d77695ba 100644
--- a/core/src/main/java/org/apache/struts2/config/impl/DefaultConfiguration.java
+++ b/core/src/main/java/org/apache/struts2/config/impl/DefaultConfiguration.java
@@ -20,15 +20,15 @@ package org.apache.struts2.config.impl;
 
 import org.apache.struts2.ActionContext;
 import org.apache.struts2.DefaultLocaleProviderFactory;
-import org.apache.struts2.DefaultTextProvider;
+import org.apache.struts2.text.DefaultTextProvider;
 import org.apache.struts2.FileManager;
 import org.apache.struts2.FileManagerFactory;
 import org.apache.struts2.LocaleProviderFactory;
-import org.apache.struts2.LocalizedTextProvider;
+import org.apache.struts2.text.LocalizedTextProvider;
 import org.apache.struts2.ObjectFactory;
-import org.apache.struts2.StrutsTextProviderFactory;
-import org.apache.struts2.TextProvider;
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.StrutsTextProviderFactory;
+import org.apache.struts2.text.TextProvider;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.config.Configuration;
 import org.apache.struts2.config.ConfigurationException;
 import org.apache.struts2.config.ContainerProvider;
@@ -92,7 +92,7 @@ import org.apache.struts2.ognl.accessor.RootAccessor;
 import org.apache.struts2.ognl.accessor.XWorkMethodAccessor;
 import org.apache.struts2.util.OgnlTextParser;
 import org.apache.struts2.util.PatternMatcher;
-import org.apache.struts2.util.StrutsLocalizedTextProvider;
+import org.apache.struts2.text.StrutsLocalizedTextProvider;
 import org.apache.struts2.util.TextParser;
 import org.apache.struts2.util.ValueStack;
 import org.apache.struts2.util.ValueStackFactory;
diff --git a/core/src/main/java/org/apache/struts2/conversion/impl/DateConverter.java b/core/src/main/java/org/apache/struts2/conversion/impl/DateConverter.java
index 6d89be284..753e72766 100644
--- a/core/src/main/java/org/apache/struts2/conversion/impl/DateConverter.java
+++ b/core/src/main/java/org/apache/struts2/conversion/impl/DateConverter.java
@@ -19,7 +19,7 @@
 package org.apache.struts2.conversion.impl;
 
 import org.apache.struts2.ActionContext;
-import org.apache.struts2.TextProvider;
+import org.apache.struts2.text.TextProvider;
 import org.apache.struts2.util.ValueStack;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
diff --git a/core/src/main/java/org/apache/struts2/conversion/impl/XWorkConverter.java b/core/src/main/java/org/apache/struts2/conversion/impl/XWorkConverter.java
index 507f765d0..89d3ecceb 100644
--- a/core/src/main/java/org/apache/struts2/conversion/impl/XWorkConverter.java
+++ b/core/src/main/java/org/apache/struts2/conversion/impl/XWorkConverter.java
@@ -21,7 +21,7 @@ package org.apache.struts2.conversion.impl;
 import org.apache.struts2.ActionContext;
 import org.apache.struts2.FileManager;
 import org.apache.struts2.FileManagerFactory;
-import org.apache.struts2.LocalizedTextProvider;
+import org.apache.struts2.text.LocalizedTextProvider;
 import org.apache.struts2.conversion.ConversionAnnotationProcessor;
 import org.apache.struts2.conversion.ConversionFileProcessor;
 import org.apache.struts2.conversion.TypeConverter;
diff --git a/core/src/main/java/org/apache/struts2/interceptor/AbstractFileUploadInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/AbstractFileUploadInterceptor.java
index 87c1d32f3..9bad6896c 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/AbstractFileUploadInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/AbstractFileUploadInterceptor.java
@@ -20,12 +20,10 @@ package org.apache.struts2.interceptor;
 
 import org.apache.struts2.LocaleProvider;
 import org.apache.struts2.LocaleProviderFactory;
-import org.apache.struts2.TextProvider;
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProvider;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.inject.Container;
 import org.apache.struts2.inject.Inject;
-import org.apache.struts2.interceptor.AbstractInterceptor;
-import org.apache.struts2.interceptor.ValidationAware;
 import org.apache.struts2.util.TextParseUtil;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
diff --git a/core/src/main/java/org/apache/struts2/interceptor/AliasInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/AliasInterceptor.java
index 5a02dad96..37b5c383c 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/AliasInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/AliasInterceptor.java
@@ -22,7 +22,7 @@ import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.apache.struts2.ActionContext;
 import org.apache.struts2.ActionInvocation;
-import org.apache.struts2.LocalizedTextProvider;
+import org.apache.struts2.text.LocalizedTextProvider;
 import org.apache.struts2.StrutsConstants;
 import org.apache.struts2.config.entities.ActionConfig;
 import org.apache.struts2.dispatcher.HttpParameters;
diff --git a/core/src/main/java/org/apache/struts2/interceptor/StaticParametersInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/StaticParametersInterceptor.java
index 65c6d57fa..e4b1e73ae 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/StaticParametersInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/StaticParametersInterceptor.java
@@ -23,7 +23,7 @@ import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.apache.struts2.ActionContext;
 import org.apache.struts2.ActionInvocation;
-import org.apache.struts2.LocalizedTextProvider;
+import org.apache.struts2.text.LocalizedTextProvider;
 import org.apache.struts2.StrutsConstants;
 import org.apache.struts2.config.entities.ActionConfig;
 import org.apache.struts2.config.entities.Parameterizable;
diff --git a/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java
index 83d344474..7f12ea7f1 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java
@@ -19,11 +19,9 @@
 package org.apache.struts2.interceptor;
 
 import org.apache.struts2.ActionInvocation;
-import org.apache.struts2.TextProvider;
-import org.apache.struts2.TextProviderFactory;
-import org.apache.struts2.interceptor.ValidationAware;
+import org.apache.struts2.text.TextProvider;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.inject.Inject;
-import org.apache.struts2.interceptor.MethodFilterInterceptor;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.apache.struts2.ServletActionContext;
diff --git a/core/src/main/java/org/apache/struts2/ognl/OgnlValueStack.java b/core/src/main/java/org/apache/struts2/ognl/OgnlValueStack.java
index a155c1cbc..26a76f7f5 100644
--- a/core/src/main/java/org/apache/struts2/ognl/OgnlValueStack.java
+++ b/core/src/main/java/org/apache/struts2/ognl/OgnlValueStack.java
@@ -19,7 +19,7 @@
 package org.apache.struts2.ognl;
 
 import org.apache.struts2.ActionContext;
-import org.apache.struts2.TextProvider;
+import org.apache.struts2.text.TextProvider;
 import org.apache.struts2.conversion.impl.XWorkConverter;
 import org.apache.struts2.inject.Container;
 import org.apache.struts2.inject.Inject;
diff --git a/core/src/main/java/org/apache/struts2/ognl/OgnlValueStackFactory.java b/core/src/main/java/org/apache/struts2/ognl/OgnlValueStackFactory.java
index ec32f8986..ac60de0dc 100644
--- a/core/src/main/java/org/apache/struts2/ognl/OgnlValueStackFactory.java
+++ b/core/src/main/java/org/apache/struts2/ognl/OgnlValueStackFactory.java
@@ -18,7 +18,7 @@
  */
 package org.apache.struts2.ognl;
 
-import org.apache.struts2.TextProvider;
+import org.apache.struts2.text.TextProvider;
 import org.apache.struts2.conversion.NullHandler;
 import org.apache.struts2.conversion.impl.XWorkConverter;
 import org.apache.struts2.inject.Container;
diff --git a/core/src/main/java/org/apache/struts2/util/AbstractLocalizedTextProvider.java b/core/src/main/java/org/apache/struts2/text/AbstractLocalizedTextProvider.java
similarity index 90%
rename from core/src/main/java/org/apache/struts2/util/AbstractLocalizedTextProvider.java
rename to core/src/main/java/org/apache/struts2/text/AbstractLocalizedTextProvider.java
index 316cbb99e..e7683cd6c 100644
--- a/core/src/main/java/org/apache/struts2/util/AbstractLocalizedTextProvider.java
+++ b/core/src/main/java/org/apache/struts2/text/AbstractLocalizedTextProvider.java
@@ -16,15 +16,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.struts2.util;
+package org.apache.struts2.text;
 
-import org.apache.struts2.ActionContext;
-import org.apache.struts2.LocalizedTextProvider;
-import org.apache.struts2.inject.Inject;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
+import org.apache.struts2.ActionContext;
 import org.apache.struts2.StrutsConstants;
+import org.apache.struts2.inject.Inject;
+import org.apache.struts2.util.TextParseUtil;
+import org.apache.struts2.util.ValueStack;
 
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
@@ -224,11 +225,10 @@ abstract class AbstractLocalizedTextProvider implements LocalizedTextProvider {
 
     /**
      * Clear a specific bundle + locale combination from the <code>bundlesMap</code>.
-     *   Intended for descendants to use clear a bundle + locale combination.
+     * Intended for descendants to use clear a bundle + locale combination.
      *
      * @param bundleName The bundle (combined with locale) to remove from the bundle map
      * @param locale     Provides the locale to combine with the bundle to get the key
-     *
      * @since 6.0.0
      */
     protected void clearBundle(final String bundleName, Locale locale) {
@@ -239,13 +239,13 @@ abstract class AbstractLocalizedTextProvider implements LocalizedTextProvider {
 
     /**
      * Clears the <code>missingBundles</code> contents.  This allows descendants to
-     *   clear the <b>"missing bundles cache"</b> when desired (or needed).
-     *
+     * clear the <b>"missing bundles cache"</b> when desired (or needed).
+     * <p>
      * Note: This method may be used when the <code>bundlesMap</code> state has changed
-     *   in such a way that bundles that were previously "missing" may now be available
-     *   (e.g. after calling {@link #addDefaultResourceBundle(java.lang.String)} when the
-     *   {@link AbstractLocalizedTextProvider} has already been used for failed bundle
-     *   lookups of a given key, or some transitory state made a bundle lookup fail.
+     * in such a way that bundles that were previously "missing" may now be available
+     * (e.g. after calling {@link #addDefaultResourceBundle(java.lang.String)} when the
+     * {@link AbstractLocalizedTextProvider} has already been used for failed bundle
+     * lookups of a given key, or some transitory state made a bundle lookup fail.
      *
      * @since 6.0.0
      */
@@ -287,10 +287,10 @@ abstract class AbstractLocalizedTextProvider implements LocalizedTextProvider {
 
     /**
      * A helper method for {@link ResourceBundle} bundle reload logic.
-     *
+     * <p>
      * Uses standard {@link ResourceBundle} methods to clear the bundle caches for the
      * {@link ClassLoader} instances that this class is aware of at the time of the call.
-     *
+     * <p>
      * The <code>clearCache()</code> methods have been available since Java 1.6, so
      * it is anticipated the logic will work on any subsequent JVM versions.
      *
@@ -301,27 +301,29 @@ abstract class AbstractLocalizedTextProvider implements LocalizedTextProvider {
         ResourceBundle.clearCache();     // Bundles loaded by the caller's classloader.
         ResourceBundle.clearCache(ccl);  // Bundles loaded by the context classloader (may be the same).
         // Clear the bundle cache for any non-null delegated classloaders.
-        delegatedClassLoaderMap.forEach( (key, value) -> { if (value != null) ResourceBundle.clearCache(value) ;} );
+        delegatedClassLoaderMap.forEach((key, value) -> {
+            if (value != null) ResourceBundle.clearCache(value);
+        });
     }
 
     /**
      * "Hacky" helper method that attempts to clear the Tomcat <code>ResourceEntry</code>
      * {@link Map} using knowledge of the Tomcat source code.
-     *
+     * <p>
      * It relies on the {@link #TOMCAT_RESOURCE_ENTRIES_FIELD} field name, base class name
      * {@link #TOMCAT_WEBAPP_CLASSLOADER_BASE}. and descendant class names {@link #TOMCAT_WEBAPP_CLASSLOADER},
      * {@link #TOMCAT_PARALLEL_WEBAPP_CLASSLOADER}, to keep the values identified in the constants.
      * It appears to be valid for Tomcat versions 7-10 so far, but could become invalid at any time in the future
      * when the resource handling logic in Tomcat changes.
-     *
+     * <p>
      * Note: With Java 9+, calling this method may result in "Illegal reflective access" warnings.  Be aware
-     *       its logic may fail in a future version of Java that blocks the reflection calls needed for this method.
+     * its logic may fail in a future version of Java that blocks the reflection calls needed for this method.
      */
     private void clearTomcatCache() {
         ClassLoader loader = getCurrentThreadContextClassLoader();
         // no need for compilation here.
-        Class cl = loader.getClass();
-        Class superCl = cl.getSuperclass();
+        Class<?> cl = loader.getClass();
+        Class<?> superCl = cl.getSuperclass();
 
         try {
             if ((TOMCAT_WEBAPP_CLASSLOADER.equals(cl.getName()) || TOMCAT_PARALLEL_WEBAPP_CLASSLOADER.equals(cl.getName())) &&
@@ -348,19 +350,19 @@ abstract class AbstractLocalizedTextProvider implements LocalizedTextProvider {
 
     /**
      * Helper method that is intended to clear a {@link Map} instance by name.
-     *
+     * <p>
      * This method relies on reflection to perform its operations, and may be blocked in Java 9 and later,
      * depending on the accessibility of the field.
      *
-     * @param cl The {@link Class} of the obj parameter.
-     * @param obj The {@link Object} from which the named field is to be extracted (may be <code>null</code> for a static field).
+     * @param cl   The {@link Class} of the obj parameter.
+     * @param obj  The {@link Object} from which the named field is to be extracted (may be <code>null</code> for a static field).
      * @param name The name of the field containing a {@link Map} reference.
-     * @throws NoSuchFieldException if a field accessed by this call does not exist.
-     * @throws IllegalAccessException if a field, method or or class accessed by this call cannot be accessed.
-     * @throws NoSuchMethodException if a method accessed by this call does not exist.
+     * @throws NoSuchFieldException      if a field accessed by this call does not exist.
+     * @throws IllegalAccessException    if a field, method or or class accessed by this call cannot be accessed.
+     * @throws NoSuchMethodException     if a method accessed by this call does not exist.
      * @throws InvocationTargetException if a method accessed by this call fails invocation.
      */
-    private void clearMap(Class cl, Object obj, String name)
+    private void clearMap(Class<?> cl, Object obj, String name)
             throws NoSuchFieldException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
 
         Field field = cl.getDeclaredField(name);
@@ -372,7 +374,7 @@ abstract class AbstractLocalizedTextProvider implements LocalizedTextProvider {
         Object cache = field.get(obj);
 
         synchronized (cache) {
-            Class ccl = cache.getClass();
+            Class<?> ccl = cache.getClass();
             Method clearMethod = ccl.getMethod("clear");
             clearMethod.invoke(cache);
         }
@@ -416,7 +418,6 @@ abstract class AbstractLocalizedTextProvider implements LocalizedTextProvider {
      * flow of the {@link LocalizedTextProvider} implementation the descendant provides).
      *
      * @param searchDefaultBundlesFirst provide {@link String} "true" or "false" to set the flag state accordingly.
-     *
      * @since 6.0.0
      */
     @Inject(value = StrutsConstants.STRUTS_I18N_SEARCH_DEFAULTBUNDLES_FIRST, required = false)
@@ -503,7 +504,7 @@ abstract class AbstractLocalizedTextProvider implements LocalizedTextProvider {
      * @return the default message.
      */
     protected GetDefaultMessageReturnArg getDefaultMessage(String key, Locale locale, ValueStack valueStack, Object[] args,
-                                                                String defaultMessage) {
+                                                           String defaultMessage) {
         GetDefaultMessageReturnArg result = null;
         boolean found = true;
 
@@ -539,18 +540,18 @@ abstract class AbstractLocalizedTextProvider implements LocalizedTextProvider {
      * general key would be passed in the alternateKey parameter.
      * </p>
      *
-     * @param key             the initial key to search for a value within the default resource bundles.
-     * @param alternateKey    the alternate (fall-back) key to search for a value within the default resource bundles, if the initial key lookup fails.
-     * @param locale          the {@link Locale} to be used for the default resource bundle lookup.
-     * @param valueStack      the {@link ValueStack} associated with the operation.
-     * @param args            the argument array for parameterized messages (may be <code>null</code>).
-     * @param defaultMessage  the default message {@link String} to use if both key lookup operations fail.
+     * @param key            the initial key to search for a value within the default resource bundles.
+     * @param alternateKey   the alternate (fall-back) key to search for a value within the default resource bundles, if the initial key lookup fails.
+     * @param locale         the {@link Locale} to be used for the default resource bundle lookup.
+     * @param valueStack     the {@link ValueStack} associated with the operation.
+     * @param args           the argument array for parameterized messages (may be <code>null</code>).
+     * @param defaultMessage the default message {@link String} to use if both key lookup operations fail.
      * @return the {@link GetDefaultMessageReturnArg} result containing the processed message lookup (by key first, then alternateKey if key's lookup fails).
-     *         If both key lookup operations fail, defaultMessage is used for processing.
-     *         If defaultMessage is <code>null</code> then the return result may be <code>null</code>.
+     * If both key lookup operations fail, defaultMessage is used for processing.
+     * If defaultMessage is <code>null</code> then the return result may be <code>null</code>.
      */
     protected GetDefaultMessageReturnArg getDefaultMessageWithAlternateKey(String key, String alternateKey, Locale locale, ValueStack valueStack,
-            Object[] args, String defaultMessage) {
+                                                                           Object[] args, String defaultMessage) {
         GetDefaultMessageReturnArg result;
         if (alternateKey == null || alternateKey.isEmpty()) {
             result = getDefaultMessage(key, locale, valueStack, args, defaultMessage);
@@ -593,8 +594,8 @@ abstract class AbstractLocalizedTextProvider implements LocalizedTextProvider {
      *
      * @return the message
      */
-    protected String findMessage(Class clazz, String key, String indexedKey, Locale locale, Object[] args, Set<String> checked,
-                                      ValueStack valueStack) {
+    protected String findMessage(Class<?> clazz, String key, String indexedKey, Locale locale, Object[] args, Set<String> checked,
+                                 ValueStack valueStack) {
         if (checked == null) {
             checked = new TreeSet<>();
         } else if (checked.contains(clazz.getName())) {
@@ -617,9 +618,9 @@ abstract class AbstractLocalizedTextProvider implements LocalizedTextProvider {
         }
 
         // look in properties of implemented interfaces
-        Class[] interfaces = clazz.getInterfaces();
+        Class<?>[] interfaces = clazz.getInterfaces();
 
-        for (Class anInterface : interfaces) {
+        for (Class<?> anInterface : interfaces) {
             msg = getMessage(anInterface.getName(), locale, key, valueStack, args);
 
             if (msg != null) {
@@ -639,7 +640,7 @@ abstract class AbstractLocalizedTextProvider implements LocalizedTextProvider {
         if (clazz.isInterface()) {
             interfaces = clazz.getInterfaces();
 
-            for (Class anInterface : interfaces) {
+            for (Class<?> anInterface : interfaces) {
                 msg = findMessage(anInterface, key, indexedKey, locale, args, checked, valueStack);
 
                 if (msg != null) {
diff --git a/core/src/main/java/org/apache/struts2/CompositeTextProvider.java b/core/src/main/java/org/apache/struts2/text/CompositeTextProvider.java
similarity index 99%
rename from core/src/main/java/org/apache/struts2/CompositeTextProvider.java
rename to core/src/main/java/org/apache/struts2/text/CompositeTextProvider.java
index 9790b5a60..70cd06708 100644
--- a/core/src/main/java/org/apache/struts2/CompositeTextProvider.java
+++ b/core/src/main/java/org/apache/struts2/text/CompositeTextProvider.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.struts2;
+package org.apache.struts2.text;
 
 import org.apache.struts2.util.ValueStack;
 import org.apache.logging.log4j.LogManager;
diff --git a/core/src/main/java/org/apache/struts2/DefaultTextProvider.java b/core/src/main/java/org/apache/struts2/text/DefaultTextProvider.java
similarity index 97%
rename from core/src/main/java/org/apache/struts2/DefaultTextProvider.java
rename to core/src/main/java/org/apache/struts2/text/DefaultTextProvider.java
index 954e2ddae..4518f4de0 100644
--- a/core/src/main/java/org/apache/struts2/DefaultTextProvider.java
+++ b/core/src/main/java/org/apache/struts2/text/DefaultTextProvider.java
@@ -16,8 +16,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.struts2;
+package org.apache.struts2.text;
 
+import org.apache.struts2.ActionContext;
+import org.apache.struts2.Unchainable;
 import org.apache.struts2.inject.Inject;
 import org.apache.struts2.util.ValueStack;
 
diff --git a/core/src/main/java/org/apache/struts2/util/GlobalLocalizedTextProvider.java b/core/src/main/java/org/apache/struts2/text/GlobalLocalizedTextProvider.java
similarity index 95%
rename from core/src/main/java/org/apache/struts2/util/GlobalLocalizedTextProvider.java
rename to core/src/main/java/org/apache/struts2/text/GlobalLocalizedTextProvider.java
index 620aa2912..33ab693dd 100644
--- a/core/src/main/java/org/apache/struts2/util/GlobalLocalizedTextProvider.java
+++ b/core/src/main/java/org/apache/struts2/text/GlobalLocalizedTextProvider.java
@@ -16,18 +16,19 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.struts2.util;
+package org.apache.struts2.text;
 
-import org.apache.struts2.ActionContext;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
+import org.apache.struts2.ActionContext;
+import org.apache.struts2.util.ValueStack;
 
 import java.util.Locale;
 import java.util.ResourceBundle;
 
 /**
  * Provides support for localization in the framework, it can be used to read only default bundles.
- *
+ * <p>
  * Note that unlike {@link StrutsLocalizedTextProvider}, this class {@link GlobalLocalizedTextProvider} will
  * <em>only</em> search the default bundles for localized text.
  */
@@ -51,7 +52,7 @@ public class GlobalLocalizedTextProvider extends AbstractLocalizedTextProvider {
      * @see #findText(Class aClass, String aTextName, Locale locale, String defaultMessage, Object[] args)
      */
     @Override
-    public 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]);
     }
 
@@ -88,7 +89,7 @@ public class GlobalLocalizedTextProvider extends AbstractLocalizedTextProvider {
      * @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) {
+    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);
 
@@ -132,7 +133,7 @@ public class GlobalLocalizedTextProvider extends AbstractLocalizedTextProvider {
      * @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) {
+    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!");
diff --git a/core/src/main/java/org/apache/struts2/LocalizedTextProvider.java b/core/src/main/java/org/apache/struts2/text/LocalizedTextProvider.java
similarity index 82%
rename from core/src/main/java/org/apache/struts2/LocalizedTextProvider.java
rename to core/src/main/java/org/apache/struts2/text/LocalizedTextProvider.java
index 967a6d478..fcaf39975 100644
--- a/core/src/main/java/org/apache/struts2/LocalizedTextProvider.java
+++ b/core/src/main/java/org/apache/struts2/text/LocalizedTextProvider.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.struts2;
+package org.apache.struts2.text;
 
 import org.apache.struts2.util.ValueStack;
 
@@ -32,11 +32,11 @@ public interface LocalizedTextProvider extends Serializable {
 
     ResourceBundle findResourceBundle(String aBundleName, Locale locale);
 
-    String findText(Class aClass, String aTextName, 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);
 
-    String findText(Class aClass, String aTextName, Locale locale, String defaultMessage, Object[] args, ValueStack valueStack);
+    String findText(Class<?> aClass, String aTextName, Locale locale, String defaultMessage, Object[] args, ValueStack valueStack);
 
     String findText(ResourceBundle bundle, String aTextName, Locale locale);
 
diff --git a/core/src/main/java/org/apache/struts2/ResourceBundleTextProvider.java b/core/src/main/java/org/apache/struts2/text/ResourceBundleTextProvider.java
similarity index 93%
rename from core/src/main/java/org/apache/struts2/ResourceBundleTextProvider.java
rename to core/src/main/java/org/apache/struts2/text/ResourceBundleTextProvider.java
index b2ee3cad7..a0385fd6e 100644
--- a/core/src/main/java/org/apache/struts2/ResourceBundleTextProvider.java
+++ b/core/src/main/java/org/apache/struts2/text/ResourceBundleTextProvider.java
@@ -16,7 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.struts2;
+package org.apache.struts2.text;
+
+import org.apache.struts2.LocaleProvider;
 
 import java.util.ResourceBundle;
 
@@ -39,7 +41,7 @@ public interface ResourceBundleTextProvider extends TextProvider {
      *
      * @param clazz the class to use for loading.
      */
-    void setClazz(Class clazz);
+    void setClazz(Class<?> clazz);
 
     /**
      * Set the LocaleProvider to use.
diff --git a/core/src/main/java/org/apache/struts2/util/StrutsLocalizedTextProvider.java b/core/src/main/java/org/apache/struts2/text/StrutsLocalizedTextProvider.java
similarity index 96%
rename from core/src/main/java/org/apache/struts2/util/StrutsLocalizedTextProvider.java
rename to core/src/main/java/org/apache/struts2/text/StrutsLocalizedTextProvider.java
index ea37726b9..3199d8a0f 100644
--- a/core/src/main/java/org/apache/struts2/util/StrutsLocalizedTextProvider.java
+++ b/core/src/main/java/org/apache/struts2/text/StrutsLocalizedTextProvider.java
@@ -16,13 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.struts2.util;
+package org.apache.struts2.text;
 
 import org.apache.struts2.ActionContext;
 import org.apache.struts2.ActionInvocation;
 import org.apache.struts2.ModelDriven;
 import org.apache.struts2.conversion.impl.XWorkConverter;
 import org.apache.struts2.inject.Inject;
+import org.apache.struts2.util.ValueStack;
 import org.apache.struts2.util.reflection.ReflectionProvider;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
@@ -56,7 +57,7 @@ public class StrutsLocalizedTextProvider extends AbstractLocalizedTextProvider {
      * @see #findText(Class aClass, String aTextName, Locale locale, String defaultMessage, Object[] args)
      */
     @Override
-    public 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]);
     }
 
@@ -109,7 +110,7 @@ public class StrutsLocalizedTextProvider extends AbstractLocalizedTextProvider {
      * @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) {
+    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);
 
@@ -169,7 +170,7 @@ public class StrutsLocalizedTextProvider extends AbstractLocalizedTextProvider {
      * @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,
+    public String findText(Class<?> aClass, String aTextName, Locale locale, String defaultMessage, Object[] args,
                            ValueStack valueStack) {
         String indexedTextName = null;
         if (aTextName == null) {
@@ -220,7 +221,7 @@ public class StrutsLocalizedTextProvider extends AbstractLocalizedTextProvider {
             if (actionInvocation != null) {
                 Object action = actionInvocation.getAction();
                 if (action instanceof ModelDriven) {
-                    Object model = ((ModelDriven) action).getModel();
+                    Object model = ((ModelDriven<?>) action).getModel();
                     if (model != null) {
                         msg = findMessage(model.getClass(), aTextName, indexedTextName, locale, args, null, valueStack);
                         if (msg != null) {
@@ -232,7 +233,7 @@ public class StrutsLocalizedTextProvider extends AbstractLocalizedTextProvider {
         }
 
         // nothing still? alright, search the package hierarchy now
-        for (Class clazz = aClass;
+        for (Class<?> clazz = aClass;
              (clazz != null) && !clazz.equals(Object.class);
              clazz = clazz.getSuperclass()) {
 
@@ -283,7 +284,7 @@ public class StrutsLocalizedTextProvider extends AbstractLocalizedTextProvider {
                         PropertyDescriptor propertyDescriptor = reflectionProvider.getPropertyDescriptor(actionObj.getClass(), prop);
 
                         if (propertyDescriptor != null) {
-                            Class clazz = propertyDescriptor.getPropertyType();
+                            Class<?> clazz = propertyDescriptor.getPropertyType();
 
                             if (clazz != null) {
                                 if (obj != null) {
diff --git a/core/src/main/java/org/apache/struts2/StrutsTextProviderFactory.java b/core/src/main/java/org/apache/struts2/text/StrutsTextProviderFactory.java
similarity index 95%
rename from core/src/main/java/org/apache/struts2/StrutsTextProviderFactory.java
rename to core/src/main/java/org/apache/struts2/text/StrutsTextProviderFactory.java
index 06a4617a0..4f7331263 100644
--- a/core/src/main/java/org/apache/struts2/StrutsTextProviderFactory.java
+++ b/core/src/main/java/org/apache/struts2/text/StrutsTextProviderFactory.java
@@ -16,8 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.struts2;
+package org.apache.struts2.text;
 
+import org.apache.struts2.LocaleProviderFactory;
 import org.apache.struts2.inject.Inject;
 
 import java.util.ResourceBundle;
@@ -49,7 +50,7 @@ public class StrutsTextProviderFactory implements TextProviderFactory {
     }
 
     @Override
-    public TextProvider createInstance(Class clazz) {
+    public TextProvider createInstance(Class<?> clazz) {
         TextProvider instance = getTextProvider(clazz);
         if (instance instanceof ResourceBundleTextProvider) {
             ((ResourceBundleTextProvider) instance).setClazz(clazz);
diff --git a/core/src/main/java/org/apache/struts2/TextProvider.java b/core/src/main/java/org/apache/struts2/text/TextProvider.java
similarity index 96%
rename from core/src/main/java/org/apache/struts2/TextProvider.java
rename to core/src/main/java/org/apache/struts2/text/TextProvider.java
index 16924a757..bdd2f026c 100644
--- a/core/src/main/java/org/apache/struts2/TextProvider.java
+++ b/core/src/main/java/org/apache/struts2/text/TextProvider.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.struts2;
+package org.apache.struts2.text;
 
 import org.apache.struts2.util.ValueStack;
 
@@ -33,9 +33,9 @@ import java.util.ResourceBundle;
  * global texts to be defined for an application base class.
  *
  * <p>
- * You can override {@link LocaleProvider#getLocale()} to change the behaviour of how
+ * You can override {@link org.apache.struts2.LocaleProvider#getLocale()} to change the behaviour of how
  * to choose locale for the bundles that are returned. Typically you would
- * use the {@link LocaleProvider} interface to get the users configured locale.
+ * use the {@link org.apache.struts2.LocaleProvider} interface to get the users configured locale.
  * </p>
  *
  * <p>
@@ -56,7 +56,7 @@ import java.util.ResourceBundle;
  * </p>
  * @author Jason Carreira
  * @author Rainer Hermanns
- * @see LocaleProvider
+ * @see org.apache.struts2.LocaleProvider
  * @see TextProviderSupport
  */
 public interface TextProvider {
diff --git a/core/src/main/java/org/apache/struts2/TextProviderFactory.java b/core/src/main/java/org/apache/struts2/text/TextProviderFactory.java
similarity index 91%
rename from core/src/main/java/org/apache/struts2/TextProviderFactory.java
rename to core/src/main/java/org/apache/struts2/text/TextProviderFactory.java
index b7c5a1f5d..5ef4070cd 100644
--- a/core/src/main/java/org/apache/struts2/TextProviderFactory.java
+++ b/core/src/main/java/org/apache/struts2/text/TextProviderFactory.java
@@ -16,13 +16,13 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.struts2;
+package org.apache.struts2.text;
 
 import java.util.ResourceBundle;
 
 public interface TextProviderFactory {
 
-    TextProvider createInstance(Class clazz);
+    TextProvider createInstance(Class<?> clazz);
 
     TextProvider createInstance(ResourceBundle bundle);
 
diff --git a/core/src/main/java/org/apache/struts2/TextProviderSupport.java b/core/src/main/java/org/apache/struts2/text/TextProviderSupport.java
similarity index 90%
rename from core/src/main/java/org/apache/struts2/TextProviderSupport.java
rename to core/src/main/java/org/apache/struts2/text/TextProviderSupport.java
index cee8b8601..bf2fa685a 100644
--- a/core/src/main/java/org/apache/struts2/TextProviderSupport.java
+++ b/core/src/main/java/org/apache/struts2/text/TextProviderSupport.java
@@ -16,12 +16,19 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.struts2;
+package org.apache.struts2.text;
 
+import org.apache.struts2.LocaleProvider;
+import org.apache.struts2.LocaleProviderFactory;
 import org.apache.struts2.inject.Inject;
 import org.apache.struts2.util.ValueStack;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
 
 /**
  * Default TextProvider implementation.
@@ -31,7 +38,7 @@ import java.util.*;
  */
 public class TextProviderSupport implements ResourceBundleTextProvider {
 
-    protected Class clazz;
+    protected Class<?> clazz;
     protected LocaleProvider localeProvider;
     protected ResourceBundle bundle;
     protected LocalizedTextProvider localizedTextProvider;
@@ -42,7 +49,7 @@ 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, LocalizedTextProvider localizedTextProvider) {
+    public TextProviderSupport(Class<?> clazz, LocaleProvider provider, LocalizedTextProvider localizedTextProvider) {
         this.clazz = clazz;
         this.localeProvider = provider;
         this.localizedTextProvider = localizedTextProvider;
@@ -72,7 +79,7 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
      * @param clazz a clazz to use for reading the resource bundle.
      */
     @Override
-    public void setClazz(Class clazz) {
+    public void setClazz(Class<?> clazz) {
         this.clazz = clazz;
     }
 
@@ -103,13 +110,13 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
      * class.
      */
     public boolean hasKey(String key) {
-    	String message;
-    	if (clazz != null) {
-            message = localizedTextProvider.findText(clazz, key, getLocale(), null, new Object[0] );
+        String message;
+        if (clazz != null) {
+            message = localizedTextProvider.findText(clazz, key, getLocale(), null, new Object[0]);
         } else {
             message = localizedTextProvider.findText(bundle, key, getLocale(), null, new Object[0]);
         }
-    	return message != null;
+        return message != null;
     }
 
     /**
@@ -135,7 +142,7 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
      * a cascading style that allow global texts to be defined for an application base
      * class. If no text is found for this text name, the default value is returned.
      *
-     * @param key    name of text to be found
+     * @param key          name of text to be found
      * @param defaultValue the default value which will be returned if no text is found
      * @return value of named text or the provided defaultValue if no value is found
      */
@@ -151,7 +158,7 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
      * a cascading style that allow global texts to be defined for an application base
      * class. If no text is found for this text name, the default value is returned.
      *
-     * @param key    name of text to be found
+     * @param key          name of text to be found
      * @param defaultValue the default value which will be returned if no text is found
      * @return value of named text or the provided defaultValue if no value is found
      */
@@ -169,8 +176,8 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
      * a cascading style that allow global texts to be defined for an application base
      * class. If no text is found for this text name, the default value is returned.
      *
-     * @param key name of text to be found
-     * @param args      a List of args to be used in a MessageFormat message
+     * @param key  name of text to be found
+     * @param args a List of args to be used in a MessageFormat message
      * @return value of named text or the provided key if no value is found
      */
     public String getText(String key, List<?> args) {
@@ -185,8 +192,8 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
      * a cascading style that allow global texts to be defined for an application base
      * class. If no text is found for this text name, the default value is returned.
      *
-     * @param key name of text to be found
-     * @param args      an array of args to be used in a MessageFormat message
+     * @param key  name of text to be found
+     * @param args an array of args to be used in a MessageFormat message
      * @return value of named text or the provided key if no value is found
      */
     public String getText(String key, String[] args) {
@@ -201,7 +208,7 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
      * a cascading style that allow global texts to be defined for an application base
      * class. If no text is found for this text name, the default value is returned.
      *
-     * @param key    name of text to be found
+     * @param key          name of text to be found
      * @param defaultValue the default value which will be returned if no text is found
      * @param args         a List of args to be used in a MessageFormat message
      * @return value of named text or the provided defaultValue if no value is found
@@ -242,7 +249,7 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
      * default value is returned. Instead of using the value stack in the ActionContext
      * this version of the getText() method uses the provided value stack.
      *
-     * @param key    the resource bundle key that is to be searched for
+     * @param key          the resource bundle key that is to be searched for
      * @param defaultValue the default value which will be returned if no message is found
      * @param args         a list args to be used in a {@link java.text.MessageFormat} message
      * @param stack        the value stack to use for finding the text
@@ -251,10 +258,10 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
     public String getText(String key, String defaultValue, List<?> args, ValueStack stack) {
         Object[] argsArray = ((args != null) ? args.toArray() : null);
         Locale locale;
-        if (stack == null){
-        	locale = getLocale();
-        }else{
-        	locale = stack.getActionContext().getLocale();
+        if (stack == null) {
+            locale = getLocale();
+        } else {
+            locale = stack.getActionContext().getLocale();
         }
         if (locale == null) {
             locale = getLocale();
@@ -266,7 +273,6 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
         }
     }
 
-
     /**
      * Gets a message based on a key using the supplied args, as defined in
      * {@link java.text.MessageFormat}, or, if the message is not found, a supplied
@@ -280,21 +286,7 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
      * @return the message as found in the resource bundle, or defaultValue if none is found
      */
     public String getText(String key, String defaultValue, String[] args, ValueStack stack) {
-        Locale locale;
-        if (stack == null){
-        	locale = getLocale();
-        }else{
-        	locale = stack.getActionContext().getLocale();
-        }
-        if (locale == null) {
-            locale = getLocale();
-        }
-        if (clazz != null) {
-            return localizedTextProvider.findText(clazz, key, locale, defaultValue, args, stack);
-        } else {
-            return localizedTextProvider.findText(bundle, key, locale, defaultValue, args, stack);
-        }
-
+        return getText(key, defaultValue, args != null ? Arrays.stream(args).toList() : List.of(), stack);
     }
 
     /**
diff --git a/core/src/main/java/org/apache/struts2/util/DebugUtils.java b/core/src/main/java/org/apache/struts2/util/DebugUtils.java
index 099f70171..a7cb8dcce 100644
--- a/core/src/main/java/org/apache/struts2/util/DebugUtils.java
+++ b/core/src/main/java/org/apache/struts2/util/DebugUtils.java
@@ -18,7 +18,7 @@
  */
 package org.apache.struts2.util;
 
-import org.apache.struts2.TextProvider;
+import org.apache.struts2.text.TextProvider;
 import org.apache.struts2.interceptor.ValidationAware;
 import org.apache.logging.log4j.Logger;
 
diff --git a/core/src/main/java/org/apache/struts2/util/TextProviderHelper.java b/core/src/main/java/org/apache/struts2/util/TextProviderHelper.java
index 7cda5d490..dc5120ef0 100644
--- a/core/src/main/java/org/apache/struts2/util/TextProviderHelper.java
+++ b/core/src/main/java/org/apache/struts2/util/TextProviderHelper.java
@@ -18,8 +18,7 @@
  */
 package org.apache.struts2.util;
 
-import org.apache.struts2.TextProvider;
-import org.apache.struts2.util.ValueStack;
+import org.apache.struts2.text.TextProvider;
 import org.apache.commons.text.StringEscapeUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
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 985ad6580..4b4b939fa 100644
--- a/core/src/main/java/org/apache/struts2/util/TokenHelper.java
+++ b/core/src/main/java/org/apache/struts2/util/TokenHelper.java
@@ -19,7 +19,7 @@
 package org.apache.struts2.util;
 
 import org.apache.struts2.ActionContext;
-import org.apache.struts2.LocalizedTextProvider;
+import org.apache.struts2.text.LocalizedTextProvider;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.apache.struts2.dispatcher.Parameter;
diff --git a/core/src/main/java/org/apache/struts2/validator/DefaultActionValidatorManager.java b/core/src/main/java/org/apache/struts2/validator/DefaultActionValidatorManager.java
index 275aaf169..2f2b758b7 100644
--- a/core/src/main/java/org/apache/struts2/validator/DefaultActionValidatorManager.java
+++ b/core/src/main/java/org/apache/struts2/validator/DefaultActionValidatorManager.java
@@ -21,7 +21,7 @@ package org.apache.struts2.validator;
 import org.apache.struts2.ActionContext;
 import org.apache.struts2.FileManager;
 import org.apache.struts2.FileManagerFactory;
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.inject.Inject;
 import org.apache.struts2.util.ClassLoaderUtil;
 import org.apache.struts2.util.ValueStack;
diff --git a/core/src/main/java/org/apache/struts2/validator/DelegatingValidatorContext.java b/core/src/main/java/org/apache/struts2/validator/DelegatingValidatorContext.java
index 56500f71f..255369745 100644
--- a/core/src/main/java/org/apache/struts2/validator/DelegatingValidatorContext.java
+++ b/core/src/main/java/org/apache/struts2/validator/DelegatingValidatorContext.java
@@ -21,11 +21,11 @@ package org.apache.struts2.validator;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.apache.struts2.ActionContext;
-import org.apache.struts2.CompositeTextProvider;
+import org.apache.struts2.text.CompositeTextProvider;
 import org.apache.struts2.LocaleProvider;
 import org.apache.struts2.LocaleProviderFactory;
-import org.apache.struts2.TextProvider;
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProvider;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.interceptor.ValidationAware;
 import org.apache.struts2.util.ValueStack;
 
diff --git a/core/src/main/java/org/apache/struts2/validator/ValidatorContext.java b/core/src/main/java/org/apache/struts2/validator/ValidatorContext.java
index f5401b7ce..8460ae031 100644
--- a/core/src/main/java/org/apache/struts2/validator/ValidatorContext.java
+++ b/core/src/main/java/org/apache/struts2/validator/ValidatorContext.java
@@ -19,7 +19,7 @@
 package org.apache.struts2.validator;
 
 import org.apache.struts2.LocaleProvider;
-import org.apache.struts2.TextProvider;
+import org.apache.struts2.text.TextProvider;
 import org.apache.struts2.interceptor.ValidationAware;
 
 /**
diff --git a/core/src/main/java/org/apache/struts2/validator/validators/ValidatorSupport.java b/core/src/main/java/org/apache/struts2/validator/validators/ValidatorSupport.java
index 4362884e3..3b896d4dc 100644
--- a/core/src/main/java/org/apache/struts2/validator/validators/ValidatorSupport.java
+++ b/core/src/main/java/org/apache/struts2/validator/validators/ValidatorSupport.java
@@ -18,7 +18,7 @@
  */
 package org.apache.struts2.validator.validators;
 
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.inject.Inject;
 import org.apache.struts2.util.TextParseUtil;
 import org.apache.struts2.util.ValueStack;
diff --git a/core/src/main/java/org/apache/struts2/validator/validators/VisitorFieldValidator.java b/core/src/main/java/org/apache/struts2/validator/validators/VisitorFieldValidator.java
index 3b4d87805..70a8e4c03 100644
--- a/core/src/main/java/org/apache/struts2/validator/validators/VisitorFieldValidator.java
+++ b/core/src/main/java/org/apache/struts2/validator/validators/VisitorFieldValidator.java
@@ -19,8 +19,8 @@
 package org.apache.struts2.validator.validators;
 
 import org.apache.struts2.ActionContext;
-import org.apache.struts2.CompositeTextProvider;
-import org.apache.struts2.TextProvider;
+import org.apache.struts2.text.CompositeTextProvider;
+import org.apache.struts2.text.TextProvider;
 import org.apache.struts2.inject.Inject;
 import org.apache.struts2.util.ValueStack;
 import org.apache.struts2.validator.ActionValidatorManager;
diff --git a/core/src/main/resources/struts-beans.xml b/core/src/main/resources/struts-beans.xml
index d3f8c879a..6b266f0f8 100644
--- a/core/src/main/resources/struts-beans.xml
+++ b/core/src/main/resources/struts-beans.xml
@@ -128,15 +128,15 @@
     <bean type="org.apache.struts2.conversion.impl.StringConverter" name="struts"
           class="org.apache.struts2.conversion.impl.StringConverter" scope="singleton"/>
 
-    <bean type="org.apache.struts2.LocalizedTextProvider" name="global-only"
-          class="org.apache.struts2.util.GlobalLocalizedTextProvider" scope="singleton"/>
-    <bean type="org.apache.struts2.LocalizedTextProvider" name="struts"
-          class="org.apache.struts2.util.StrutsLocalizedTextProvider" scope="singleton"/>
+    <bean type="org.apache.struts2.text.LocalizedTextProvider" name="global-only"
+          class="org.apache.struts2.text.GlobalLocalizedTextProvider" scope="singleton"/>
+    <bean type="org.apache.struts2.text.LocalizedTextProvider" name="struts"
+          class="org.apache.struts2.text.StrutsLocalizedTextProvider" scope="singleton"/>
 
-    <bean type="org.apache.struts2.TextProvider" name="system" class="org.apache.struts2.DefaultTextProvider"
+    <bean type="org.apache.struts2.text.TextProvider" name="system" class="org.apache.struts2.text.DefaultTextProvider"
           scope="singleton"/>
-    <bean type="org.apache.struts2.TextProviderFactory" name="struts"
-          class="org.apache.struts2.StrutsTextProviderFactory" scope="singleton"/>
+    <bean type="org.apache.struts2.text.TextProviderFactory" name="struts"
+          class="org.apache.struts2.text.StrutsTextProviderFactory" scope="singleton"/>
     <bean type="org.apache.struts2.LocaleProviderFactory" name="struts"
           class="org.apache.struts2.DefaultLocaleProviderFactory" scope="singleton"/>
 
diff --git a/core/src/test/java/org/apache/struts2/ActionSupportTest.java b/core/src/test/java/org/apache/struts2/ActionSupportTest.java
index e42271dea..6ab4e9ae9 100644
--- a/core/src/test/java/org/apache/struts2/ActionSupportTest.java
+++ b/core/src/test/java/org/apache/struts2/ActionSupportTest.java
@@ -20,6 +20,7 @@ package org.apache.struts2;
 
 import org.apache.struts2.action.Action;
 import org.apache.struts2.conversion.impl.ConversionData;
+import org.apache.struts2.text.TextProvider;
 import org.apache.struts2.util.ValueStack;
 import org.apache.struts2.interceptor.parameter.StrutsParameter;
 
diff --git a/core/src/test/java/org/apache/struts2/LocaleAwareTest.java b/core/src/test/java/org/apache/struts2/LocaleAwareTest.java
index 3cceecfe6..e4810f85d 100644
--- a/core/src/test/java/org/apache/struts2/LocaleAwareTest.java
+++ b/core/src/test/java/org/apache/struts2/LocaleAwareTest.java
@@ -20,6 +20,7 @@ package org.apache.struts2;
 
 import org.apache.struts2.config.providers.MockConfigurationProvider;
 import org.apache.struts2.config.providers.XmlConfigurationProvider;
+import org.apache.struts2.text.TextProvider;
 import org.apache.struts2.util.ValueStack;
 import org.apache.struts2.util.ValueStackFactory;
 import org.apache.struts2.config.StrutsXmlConfigurationProvider;
diff --git a/core/src/test/java/org/apache/struts2/ModelDrivenAction.java b/core/src/test/java/org/apache/struts2/ModelDrivenAction.java
index 3ba4dfcb7..0d889d71d 100644
--- a/core/src/test/java/org/apache/struts2/ModelDrivenAction.java
+++ b/core/src/test/java/org/apache/struts2/ModelDrivenAction.java
@@ -27,7 +27,7 @@ import org.apache.struts2.interceptor.parameter.StrutsParameter;
  * @author Jason Carreira
  *         Created Apr 8, 2003 6:27:29 PM
  */
-public class ModelDrivenAction extends ActionSupport implements ModelDriven {
+public class ModelDrivenAction extends ActionSupport implements ModelDriven<TestBean> {
 
     private String foo;
     private final TestBean model = new TestBean();
diff --git a/core/src/test/java/org/apache/struts2/ObjectFactoryTest.java b/core/src/test/java/org/apache/struts2/ObjectFactoryTest.java
index 25db28e25..995d5736d 100644
--- a/core/src/test/java/org/apache/struts2/ObjectFactoryTest.java
+++ b/core/src/test/java/org/apache/struts2/ObjectFactoryTest.java
@@ -20,6 +20,7 @@ package org.apache.struts2;
 
 import org.apache.struts2.mock.DummyTextProvider;
 import org.apache.struts2.mock.InjectableAction;
+import org.apache.struts2.text.TextProvider;
 
 import java.util.HashMap;
 
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 8ed97da07..a0726e0f0 100644
--- a/core/src/test/java/org/apache/struts2/components/ComponentTest.java
+++ b/core/src/test/java/org/apache/struts2/components/ComponentTest.java
@@ -18,7 +18,7 @@
  */
 package org.apache.struts2.components;
 
-import org.apache.struts2.LocalizedTextProvider;
+import org.apache.struts2.text.LocalizedTextProvider;
 import org.apache.struts2.StrutsException;
 import org.apache.struts2.TestConfigurationProvider;
 import org.apache.struts2.views.jsp.AbstractTagTest;
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 cb283cb28..052763666 100644
--- a/core/src/test/java/org/apache/struts2/config/SettingsTest.java
+++ b/core/src/test/java/org/apache/struts2/config/SettingsTest.java
@@ -18,7 +18,7 @@
  */
 package org.apache.struts2.config;
 
-import org.apache.struts2.LocalizedTextProvider;
+import org.apache.struts2.text.LocalizedTextProvider;
 import org.apache.struts2.StrutsConstants;
 import org.apache.struts2.StrutsInternalTestCase;
 
diff --git a/core/src/test/java/org/apache/struts2/config/StrutsBeanSelectionProviderTest.java b/core/src/test/java/org/apache/struts2/config/StrutsBeanSelectionProviderTest.java
index aaff8ef9d..b5aef2a59 100644
--- a/core/src/test/java/org/apache/struts2/config/StrutsBeanSelectionProviderTest.java
+++ b/core/src/test/java/org/apache/struts2/config/StrutsBeanSelectionProviderTest.java
@@ -21,8 +21,7 @@ package org.apache.struts2.config;
 import java.util.Locale;
 
 import org.apache.struts2.XWorkTestCase;
-import org.apache.struts2.LocalizedTextProvider;
-import org.apache.struts2.config.ConfigurationException;
+import org.apache.struts2.text.LocalizedTextProvider;
 import org.apache.struts2.test.StubConfigurationProvider;
 import org.apache.struts2.StrutsConstants;
 
diff --git a/core/src/test/java/org/apache/struts2/config/providers/ConfigurationProviderOgnlAllowlistTest.java b/core/src/test/java/org/apache/struts2/config/providers/ConfigurationProviderOgnlAllowlistTest.java
index f0eabcc3a..cd01de13f 100644
--- a/core/src/test/java/org/apache/struts2/config/providers/ConfigurationProviderOgnlAllowlistTest.java
+++ b/core/src/test/java/org/apache/struts2/config/providers/ConfigurationProviderOgnlAllowlistTest.java
@@ -52,7 +52,7 @@ public class ConfigurationProviderOgnlAllowlistTest extends XWorkJUnit4TestCase
                 Class.forName("org.apache.struts2.interceptor.ConditionalInterceptor"),
                 Class.forName("org.apache.struts2.ActionSupport"),
                 Class.forName("org.apache.struts2.result.ActionChainResult"),
-                Class.forName("org.apache.struts2.TextProvider"),
+                Class.forName("org.apache.struts2.text.TextProvider"),
                 Class.forName("org.apache.struts2.interceptor.NoOpInterceptor"),
                 Class.forName("org.apache.struts2.interceptor.Interceptor"),
                 Class.forName("java.lang.Object"),
@@ -77,7 +77,7 @@ public class ConfigurationProviderOgnlAllowlistTest extends XWorkJUnit4TestCase
                 Class.forName("org.apache.struts2.mock.MockResult"),
                 Class.forName("org.apache.struts2.interceptor.ConditionalInterceptor"),
                 Class.forName("org.apache.struts2.ActionSupport"),
-                Class.forName("org.apache.struts2.TextProvider"),
+                Class.forName("org.apache.struts2.text.TextProvider"),
                 Class.forName("org.apache.struts2.interceptor.Interceptor"),
                 Class.forName("java.lang.Object"),
                 Class.forName("org.apache.struts2.Validateable"),
@@ -101,7 +101,7 @@ public class ConfigurationProviderOgnlAllowlistTest extends XWorkJUnit4TestCase
                 Class.forName("org.apache.struts2.interceptor.ConditionalInterceptor"),
                 Class.forName("org.apache.struts2.ActionSupport"),
                 Class.forName("org.apache.struts2.result.ActionChainResult"),
-                Class.forName("org.apache.struts2.TextProvider"),
+                Class.forName("org.apache.struts2.text.TextProvider"),
                 Class.forName("org.apache.struts2.interceptor.NoOpInterceptor"),
                 Class.forName("org.apache.struts2.interceptor.Interceptor"),
                 Class.forName("java.lang.Object"),
diff --git a/core/src/test/java/org/apache/struts2/conversion/impl/DateConverterTest.java b/core/src/test/java/org/apache/struts2/conversion/impl/DateConverterTest.java
index f08bba740..5130b9f95 100644
--- a/core/src/test/java/org/apache/struts2/conversion/impl/DateConverterTest.java
+++ b/core/src/test/java/org/apache/struts2/conversion/impl/DateConverterTest.java
@@ -19,7 +19,7 @@
 package org.apache.struts2.conversion.impl;
 
 import org.apache.struts2.ActionContext;
-import org.apache.struts2.StubTextProvider;
+import org.apache.struts2.text.StubTextProvider;
 import org.apache.struts2.StubValueStack;
 import org.apache.struts2.util.ValueStack;
 import org.apache.struts2.StrutsInternalTestCase;
diff --git a/core/src/test/java/org/apache/struts2/conversion/impl/XWorkBasicConverterTest.java b/core/src/test/java/org/apache/struts2/conversion/impl/XWorkBasicConverterTest.java
index 1744d3a3f..d10da1b88 100644
--- a/core/src/test/java/org/apache/struts2/conversion/impl/XWorkBasicConverterTest.java
+++ b/core/src/test/java/org/apache/struts2/conversion/impl/XWorkBasicConverterTest.java
@@ -19,7 +19,7 @@
 package org.apache.struts2.conversion.impl;
 
 import org.apache.struts2.ActionContext;
-import org.apache.struts2.StubTextProvider;
+import org.apache.struts2.text.StubTextProvider;
 import org.apache.struts2.StubValueStack;
 import org.apache.struts2.XWorkTestCase;
 import org.apache.struts2.util.ValueStack;
diff --git a/core/src/test/java/org/apache/struts2/conversion/impl/XWorkConverterTest.java b/core/src/test/java/org/apache/struts2/conversion/impl/XWorkConverterTest.java
index 7838d46a1..bdf2a2365 100644
--- a/core/src/test/java/org/apache/struts2/conversion/impl/XWorkConverterTest.java
+++ b/core/src/test/java/org/apache/struts2/conversion/impl/XWorkConverterTest.java
@@ -21,10 +21,10 @@ package org.apache.struts2.conversion.impl;
 import org.apache.struts2.ActionContext;
 import org.apache.struts2.ModelDrivenAction;
 import org.apache.struts2.SimpleAction;
-import org.apache.struts2.StubTextProvider;
+import org.apache.struts2.text.StubTextProvider;
 import org.apache.struts2.StubValueStack;
 import org.apache.struts2.TestBean;
-import org.apache.struts2.TextProvider;
+import org.apache.struts2.text.TextProvider;
 import org.apache.struts2.XWorkTestCase;
 import org.apache.struts2.ognl.OgnlValueStack;
 import org.apache.struts2.test.ModelDrivenAction2;
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 4545520eb..d2fa808b9 100644
--- a/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
+++ b/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
@@ -19,7 +19,7 @@
 package org.apache.struts2.dispatcher;
 
 import org.apache.struts2.ActionContext;
-import org.apache.struts2.LocalizedTextProvider;
+import org.apache.struts2.text.LocalizedTextProvider;
 import org.apache.struts2.ObjectFactory;
 import org.apache.struts2.StubValueStack;
 import org.apache.struts2.config.ConfigurationException;
diff --git a/core/src/test/java/org/apache/struts2/interceptor/parameter/ParametersInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/parameter/ParametersInterceptorTest.java
index de849cd10..c064e9269 100644
--- a/core/src/test/java/org/apache/struts2/interceptor/parameter/ParametersInterceptorTest.java
+++ b/core/src/test/java/org/apache/struts2/interceptor/parameter/ParametersInterceptorTest.java
@@ -25,7 +25,7 @@ import org.apache.struts2.ActionSupport;
 import org.apache.struts2.ModelDrivenAction;
 import org.apache.struts2.SimpleAction;
 import org.apache.struts2.TestBean;
-import org.apache.struts2.TextProvider;
+import org.apache.struts2.text.TextProvider;
 import org.apache.struts2.XWorkTestCase;
 import org.apache.struts2.config.entities.ActionConfig;
 import org.apache.struts2.config.providers.MockConfigurationProvider;
diff --git a/core/src/test/java/org/apache/struts2/mock/DummyTextProvider.java b/core/src/test/java/org/apache/struts2/mock/DummyTextProvider.java
index 9694a0c5f..a76993680 100644
--- a/core/src/test/java/org/apache/struts2/mock/DummyTextProvider.java
+++ b/core/src/test/java/org/apache/struts2/mock/DummyTextProvider.java
@@ -18,7 +18,7 @@
  */
  package org.apache.struts2.mock;
 
-import org.apache.struts2.TextProvider;
+import org.apache.struts2.text.TextProvider;
 import org.apache.struts2.util.ValueStack;
 
 import java.util.List;
diff --git a/core/src/test/java/org/apache/struts2/mock/InjectableAction.java b/core/src/test/java/org/apache/struts2/mock/InjectableAction.java
index 1c03ff9f7..c72baf288 100644
--- a/core/src/test/java/org/apache/struts2/mock/InjectableAction.java
+++ b/core/src/test/java/org/apache/struts2/mock/InjectableAction.java
@@ -18,7 +18,7 @@
  */
  package org.apache.struts2.mock;
 
-import org.apache.struts2.TextProvider;
+import org.apache.struts2.text.TextProvider;
 import org.apache.struts2.inject.Inject;
 
 public class InjectableAction {
diff --git a/core/src/test/java/org/apache/struts2/ognl/OgnlUtilTest.java b/core/src/test/java/org/apache/struts2/ognl/OgnlUtilTest.java
index 0a7b869cd..9c526ffce 100644
--- a/core/src/test/java/org/apache/struts2/ognl/OgnlUtilTest.java
+++ b/core/src/test/java/org/apache/struts2/ognl/OgnlUtilTest.java
@@ -19,7 +19,7 @@
 package org.apache.struts2.ognl;
 
 import org.apache.struts2.ActionContext;
-import org.apache.struts2.StubTextProvider;
+import org.apache.struts2.text.StubTextProvider;
 import org.apache.struts2.StubValueStack;
 import org.apache.struts2.XWorkTestCase;
 import org.apache.struts2.config.ConfigurationException;
diff --git a/core/src/test/java/org/apache/struts2/ognl/OgnlValueStackTest.java b/core/src/test/java/org/apache/struts2/ognl/OgnlValueStackTest.java
index 700be243b..d19ca812b 100644
--- a/core/src/test/java/org/apache/struts2/ognl/OgnlValueStackTest.java
+++ b/core/src/test/java/org/apache/struts2/ognl/OgnlValueStackTest.java
@@ -20,7 +20,7 @@ package org.apache.struts2.ognl;
 
 import org.apache.struts2.SimpleAction;
 import org.apache.struts2.TestBean;
-import org.apache.struts2.TextProvider;
+import org.apache.struts2.text.TextProvider;
 import org.apache.struts2.XWorkTestCase;
 import org.apache.struts2.config.ConfigurationException;
 import org.apache.struts2.conversion.impl.ConversionData;
diff --git a/core/src/test/java/org/apache/struts2/test/ModelDrivenAction2.java b/core/src/test/java/org/apache/struts2/test/ModelDrivenAction2.java
index aca87ffb2..4b22750dc 100644
--- a/core/src/test/java/org/apache/struts2/test/ModelDrivenAction2.java
+++ b/core/src/test/java/org/apache/struts2/test/ModelDrivenAction2.java
@@ -30,7 +30,6 @@ public class ModelDrivenAction2 extends ModelDrivenAction {
 
     private final TestBean2 model = new TestBean2();
 
-
     /**
      * @return the model to be pushed onto the ValueStack after the Action itself
      */
diff --git a/core/src/test/java/org/apache/struts2/CompositeTextProviderTest.java b/core/src/test/java/org/apache/struts2/text/CompositeTextProviderTest.java
similarity index 83%
rename from core/src/test/java/org/apache/struts2/CompositeTextProviderTest.java
rename to core/src/test/java/org/apache/struts2/text/CompositeTextProviderTest.java
index 822cf2066..4ab7a1ff3 100644
--- a/core/src/test/java/org/apache/struts2/CompositeTextProviderTest.java
+++ b/core/src/test/java/org/apache/struts2/text/CompositeTextProviderTest.java
@@ -16,25 +16,20 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.struts2;
+package org.apache.struts2.text;
+
+import org.apache.struts2.ActionContext;
+import org.apache.struts2.XWorkTestCase;
 
 import java.util.ArrayList;
 import java.util.Locale;
 import java.util.ResourceBundle;
 
-/**
- * <code>CompositeTextProviderTest</code>
- *
- * @author <a href="mailto:hermanns@aixcept.de">Rainer Hermanns</a>
- * @version $Id$
- */
 public class CompositeTextProviderTest extends XWorkTestCase {
 
-
     private CompositeTextProvider textProvider = null;
 
-
-    public void testGetText() throws Exception {
+    public void testGetText() {
         // we should get the text from the 1st text provider
         assertEquals(textProvider.getText("name"), "1 name");
         assertEquals(textProvider.getText("age"), "1 age");
@@ -45,8 +40,7 @@ public class CompositeTextProviderTest extends XWorkTestCase {
         assertEquals(textProvider.getText("someNonExistingKey"), "someNonExistingKey");
     }
 
-
-    public void testGetTextWithDefaultValues() throws Exception {
+    public void testGetTextWithDefaultValues() {
         assertEquals(textProvider.getText("name", "some default name"), "1 name");
         assertEquals(textProvider.getText("age", "some default age"), "1 age");
         assertEquals(textProvider.getText("no_such_key", "default value"), "default value");
@@ -56,16 +50,24 @@ public class CompositeTextProviderTest extends XWorkTestCase {
         assertEquals(textProvider.getText("bike", "some default bike"), "This is a bike");
     }
 
-
-    public void testGetTextWithDefaultValuesAndArgs() throws Exception {
+    public void testGetTextWithDefaultValuesAndArgs() {
         assertEquals(textProvider.getText("goodnight", "say good night", "Adam"), "1 good night Adam");
-        assertEquals(textProvider.getText("goodnight", "say good night", new String[] { "Adam" }), "1 good night Adam");
-        assertEquals(textProvider.getText("goodnight", "say good night", new ArrayList<Object>() { {add("Adam");} }), "1 good night Adam");
-        assertEquals(textProvider.getText("goodmorning", "say good morning", new String[] { "Jack", "Jim" }), "1 good morning Jack and Jim");
-        assertEquals(textProvider.getText("goodmorning", "say good morning", new ArrayList<Object>() { { add("Jack"); add("Jim"); }}), "1 good morning Jack and Jim");
+        assertEquals(textProvider.getText("goodnight", "say good night", new String[]{"Adam"}), "1 good night Adam");
+        assertEquals(textProvider.getText("goodnight", "say good night", new ArrayList<>() {
+            {
+                add("Adam");
+            }
+        }), "1 good night Adam");
+        assertEquals(textProvider.getText("goodmorning", "say good morning", new String[]{"Jack", "Jim"}), "1 good morning Jack and Jim");
+        assertEquals(textProvider.getText("goodmorning", "say good morning", new ArrayList<>() {
+            {
+                add("Jack");
+                add("Jim");
+            }
+        }), "1 good morning Jack and Jim");
     }
 
-    public void testHasKey() throws Exception {
+    public void testHasKey() {
         assertTrue(textProvider.hasKey("name"));
         assertTrue(textProvider.hasKey("age"));
         assertTrue(textProvider.hasKey("cat"));
@@ -77,15 +79,15 @@ public class CompositeTextProviderTest extends XWorkTestCase {
         assertFalse(textProvider.hasKey("nosuchkey"));
     }
 
-    public void testGetResourceBundleByName() throws Exception {
+    public void testGetResourceBundleByName() {
         assertNotNull(textProvider.getTexts("org.apache.struts2.validator.CompositeTextProviderTestResourceBundle1"));
         assertNotNull(textProvider.getTexts("org.apache.struts2.validator.CompositeTextProviderTestResourceBundle2"));
         assertNull(textProvider.getTexts("org.apache.struts2.validator.CompositeTextProviderTestResourceBundle3"));
     }
 
-    public void testGetResourceBundle() throws Exception {
+    public void testGetResourceBundle() {
         assertNotNull(textProvider.getTexts());
-        // we should get the first resource bundle where 'car' and 'bike' has a i18n msg
+        // we should get the first resource bundle where 'car' and 'bike' has an i18n msg
         assertNotNull(textProvider.getTexts().getString("car"));
         assertNotNull(textProvider.getTexts().getString("bike"));
     }
diff --git a/core/src/test/java/org/apache/struts2/DefaultTextProviderTest.java b/core/src/test/java/org/apache/struts2/text/DefaultTextProviderTest.java
similarity index 89%
rename from core/src/test/java/org/apache/struts2/DefaultTextProviderTest.java
rename to core/src/test/java/org/apache/struts2/text/DefaultTextProviderTest.java
index 0fa2c9442..a9ba860ee 100644
--- a/core/src/test/java/org/apache/struts2/DefaultTextProviderTest.java
+++ b/core/src/test/java/org/apache/struts2/text/DefaultTextProviderTest.java
@@ -16,22 +16,20 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.struts2;
+package org.apache.struts2.text;
+
+import org.apache.struts2.ActionContext;
+import org.apache.struts2.XWorkTestCase;
 
 import java.util.*;
 
-/**
- * Unit test for {@link DefaultTextProvider}.
- *
- * @author Claus Ibsen
- */
 public class DefaultTextProviderTest extends XWorkTestCase {
 
     private DefaultTextProvider tp;
 
-    public void testSimpleGetTexts() throws Exception {
+    public void testSimpleGetTexts() {
         assertEquals("Hello World", tp.getText("hello"));
-        assertEquals(null, tp.getText("not.in.bundle"));
+        assertNull(tp.getText("not.in.bundle"));
 
         assertEquals("Hello World", tp.getText("hello", "this is default"));
         assertEquals("this is default", tp.getText("not.in.bundle", "this is default"));
@@ -43,16 +41,16 @@ public class DefaultTextProviderTest extends XWorkTestCase {
         assertEquals("Hello World", tp.getText("hello", nullStrings));
     }
 
-   public void testGetTextsWithArgs() throws Exception {
+   public void testGetTextsWithArgs() {
         assertEquals("Hello World", tp.getText("hello", "this is default", "from me")); // no args in bundle
         assertEquals("Hello World from me", tp.getText("hello.0", "this is default", "from me"));
         assertEquals("this is default", tp.getText("not.in.bundle", "this is default", "from me"));
         assertEquals("this is default from me", tp.getText("not.in.bundle", "this is default {0}", "from me"));
 
-        assertEquals(null, tp.getText("not.in.bundle"));
+       assertNull(tp.getText("not.in.bundle"));
     }
 
-    public void testGetTextsWithListArgs() throws Exception {
+    public void testGetTextsWithListArgs() {
         List<Object> args = new ArrayList<>();
         args.add("Santa");
         args.add("loud");
@@ -68,13 +66,13 @@ public class DefaultTextProviderTest extends XWorkTestCase {
         assertEquals("Hello World Santa", tp.getText("hello.0", args)); // only 1 arg in bundle
         assertEquals("Hello World. This is Santa speaking loud", tp.getText("hello.1", args));
 
-        assertEquals(null, tp.getText("not.in.bundle", args));
+        assertNull(tp.getText("not.in.bundle", args));
 
         assertEquals("Hello World", tp.getText("hello", "this is default", (List) null));
         assertEquals("this is default", tp.getText("not.in.bundle", "this is default", (List) null));
     }
 
-    public void testGetTextsWithArrayArgs() throws Exception {
+    public void testGetTextsWithArrayArgs() {
         String[] args = { "Santa", "loud" };
         assertEquals("Hello World", tp.getText("hello", "this is default", args)); // no args in bundle
         assertEquals("Hello World Santa", tp.getText("hello.0", "this is default", args)); // only 1 arg in bundle
@@ -88,13 +86,13 @@ public class DefaultTextProviderTest extends XWorkTestCase {
         assertEquals("Hello World Santa", tp.getText("hello.0", args)); // only 1 arg in bundle
         assertEquals("Hello World. This is Santa speaking loud", tp.getText("hello.1", args));
 
-        assertEquals(null, tp.getText("not.in.bundle", args));
+        assertNull(tp.getText("not.in.bundle", args));
 
         assertEquals("Hello World", tp.getText("hello", "this is default", (String[]) null));
         assertEquals("this is default", tp.getText("not.in.bundle", "this is default", (String[]) null));
     }
 
-    public void testGetTextsWithListAndStack() throws Exception {
+    public void testGetTextsWithListAndStack() {
         List<Object> args = new ArrayList<>();
         args.add("Santa");
         args.add("loud");
@@ -107,7 +105,7 @@ public class DefaultTextProviderTest extends XWorkTestCase {
         assertEquals("this is default Santa speaking loud", tp.getText("not.in.bundle", "this is default {0} speaking {1}", args, null));
     }
 
-    public void testGetTextsWithArrayAndStack() throws Exception {
+    public void testGetTextsWithArrayAndStack() {
         String[] args = { "Santa", "loud" };
         assertEquals("Hello World", tp.getText("hello", "this is default", args, null)); // no args in bundle
         assertEquals("Hello World Santa", tp.getText("hello.0", "this is default", args, null)); // only 1 arg in bundle
@@ -118,7 +116,7 @@ public class DefaultTextProviderTest extends XWorkTestCase {
         assertEquals("this is default Santa speaking loud", tp.getText("not.in.bundle", "this is default {0} speaking {1}", args, null));
     }
 
-    public void testGetBundle() throws Exception {
+    public void testGetBundle() {
         assertNull(tp.getTexts()); // always returns null
 
         ResourceBundle rb = ResourceBundle.getBundle(TextProviderSupportTest.class.getName(), Locale.CANADA);
diff --git a/core/src/test/java/org/apache/struts2/util/StrutsLocalizedTextProviderTest.java b/core/src/test/java/org/apache/struts2/text/StrutsLocalizedTextProviderTest.java
similarity index 92%
rename from core/src/test/java/org/apache/struts2/util/StrutsLocalizedTextProviderTest.java
rename to core/src/test/java/org/apache/struts2/text/StrutsLocalizedTextProviderTest.java
index 44c68acd7..06c84f4e7 100644
--- a/core/src/test/java/org/apache/struts2/util/StrutsLocalizedTextProviderTest.java
+++ b/core/src/test/java/org/apache/struts2/text/StrutsLocalizedTextProviderTest.java
@@ -16,23 +16,24 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.struts2.util;
+package org.apache.struts2.text;
 
 import com.mockobjects.dynamic.Mock;
-import org.apache.struts2.action.Action;
 import org.apache.struts2.ActionContext;
 import org.apache.struts2.ActionInvocation;
 import org.apache.struts2.ActionProxy;
 import org.apache.struts2.ActionSupport;
-import org.apache.struts2.LocalizedTextProvider;
 import org.apache.struts2.ModelDriven;
 import org.apache.struts2.SimpleAction;
 import org.apache.struts2.XWorkTestCase;
+import org.apache.struts2.action.Action;
+import org.apache.struts2.config.StrutsXmlConfigurationProvider;
 import org.apache.struts2.config.providers.XmlConfigurationProvider;
+import org.apache.struts2.interceptor.parameter.StrutsParameter;
 import org.apache.struts2.test.ModelDrivenAction2;
 import org.apache.struts2.test.TestBean2;
-import org.apache.struts2.config.StrutsXmlConfigurationProvider;
-import org.apache.struts2.interceptor.parameter.StrutsParameter;
+import org.apache.struts2.util.Bar;
+import org.apache.struts2.util.ValueStack;
 
 import java.text.DateFormat;
 import java.text.ParseException;
@@ -41,19 +42,11 @@ import java.util.HashMap;
 import java.util.Locale;
 import java.util.ResourceBundle;
 
-
-/**
- * Unit test for {@link StrutsLocalizedTextProvider}.
- *
- * @author jcarreira
- * @author tm_jee
- * @version $Date$ $Id$
- */
 public class StrutsLocalizedTextProviderTest extends XWorkTestCase {
 
     private LocalizedTextProvider localizedTextProvider;
 
-    public void testNpeWhenClassIsPrimitive() throws Exception {
+    public void testNpeWhenClassIsPrimitive() {
         ValueStack stack = ActionContext.getContext().getValueStack();
         stack.push(new MyObject());
         String result = localizedTextProvider.findText(MyObject.class, "someObj.someI18nKey", Locale.ENGLISH, "default message", null, stack);
@@ -66,15 +59,15 @@ public class StrutsLocalizedTextProviderTest extends XWorkTestCase {
         }
     }
 
-    public void testActionGetTextWithNullObject() throws Exception {
+    public void testActionGetTextWithNullObject() {
         MyAction action = new MyAction();
         container.inject(action);
 
         Mock mockActionInvocation = new Mock(ActionInvocation.class);
         mockActionInvocation.expectAndReturn("getAction", action);
         ActionContext.getContext()
-            .withActionInvocation((ActionInvocation) mockActionInvocation.proxy())
-            .getValueStack().push(action);
+                .withActionInvocation((ActionInvocation) mockActionInvocation.proxy())
+                .getValueStack().push(action);
 
         String message = action.getText("barObj.title");
         assertEquals("Title:", message);
@@ -94,11 +87,11 @@ public class StrutsLocalizedTextProviderTest extends XWorkTestCase {
         }
     }
 
-    public void testActionGetText() throws Exception {
+    public void testActionGetText() {
         ModelDrivenAction2 action = new ModelDrivenAction2();
         container.inject(action);
 
-        TestBean2 bean = (TestBean2) action.getModel();
+        TestBean2 bean = action.getModel();
         Bar bar = new Bar();
         bean.setBarObj(bar);
 
@@ -116,7 +109,7 @@ public class StrutsLocalizedTextProviderTest extends XWorkTestCase {
         localizedTextProvider.findText(this.getClass(), null, Locale.getDefault());
     }
 
-    public void testActionGetTextXXX() throws Exception {
+    public void testActionGetTextXXX() {
         localizedTextProvider.addDefaultResourceBundle("org/apache/struts2/util/FindMe");
 
         SimpleAction action = new SimpleAction();
@@ -125,8 +118,8 @@ public class StrutsLocalizedTextProviderTest extends XWorkTestCase {
         Mock mockActionInvocation = new Mock(ActionInvocation.class);
         mockActionInvocation.expectAndReturn("getAction", action);
         ActionContext.getContext()
-            .withActionInvocation((ActionInvocation) mockActionInvocation.proxy())
-            .getValueStack().push(action);
+                .withActionInvocation((ActionInvocation) mockActionInvocation.proxy())
+                .getValueStack().push(action);
 
         String message = action.getText("bean.name");
         String foundBean2 = action.getText("bean2.name");
@@ -148,16 +141,16 @@ public class StrutsLocalizedTextProviderTest extends XWorkTestCase {
     public void testAddDefaultResourceBundle2() throws Exception {
         localizedTextProvider.addDefaultResourceBundle("org/apache/struts2/SimpleAction");
 
-        ActionProxy proxy = actionProxyFactory.createActionProxy("/", "packagelessAction", null, new HashMap<String, Object>(), false, true);
+        ActionProxy proxy = actionProxyFactory.createActionProxy("/", "packagelessAction", null, new HashMap<>(), false, true);
         proxy.execute();
     }
 
-    public void testDefaultMessage() throws Exception {
+    public void testDefaultMessage() {
         String message = localizedTextProvider.findDefaultText("xwork.error.action.execution", Locale.getDefault());
         assertEquals("Error during Action invocation", message);
     }
 
-    public void testDefaultMessageOverride() throws Exception {
+    public void testDefaultMessageOverride() {
         String message = localizedTextProvider.findDefaultText("xwork.error.action.execution", Locale.getDefault());
         assertEquals("Error during Action invocation", message);
 
@@ -167,8 +160,8 @@ public class StrutsLocalizedTextProviderTest extends XWorkTestCase {
         assertEquals("Testing resource bundle override", message);
     }
 
-    public void testFindTextInChildProperty() throws Exception {
-        ModelDriven action = new ModelDrivenAction2();
+    public void testFindTextInChildProperty() {
+        ModelDriven<?> action = new ModelDrivenAction2();
         TestBean2 bean = (TestBean2) action.getModel();
         Bar bar = new Bar();
         bean.setBarObj(bar);
@@ -184,7 +177,7 @@ public class StrutsLocalizedTextProviderTest extends XWorkTestCase {
         assertEquals("Title is invalid!", message);
     }
 
-    public void testFindTextInInterface() throws Exception {
+    public void testFindTextInInterface() {
         Action action = new ModelDrivenAction2();
         Mock mockActionInvocation = new Mock(ActionInvocation.class);
         mockActionInvocation.expectAndReturn("getAction", action);
@@ -194,8 +187,8 @@ public class StrutsLocalizedTextProviderTest extends XWorkTestCase {
         assertEquals("Foo!", message);
     }
 
-    public void testFindTextInPackage() throws Exception {
-        ModelDriven action = new ModelDrivenAction2();
+    public void testFindTextInPackage() {
+        ModelDriven<?> action = new ModelDrivenAction2();
 
         Mock mockActionInvocation = new Mock(ActionInvocation.class);
         mockActionInvocation.expectAndReturn("getAction", action);
@@ -205,12 +198,12 @@ public class StrutsLocalizedTextProviderTest extends XWorkTestCase {
         assertEquals("It works!", message);
     }
 
-    public void testParameterizedDefaultMessage() throws Exception {
+    public void testParameterizedDefaultMessage() {
         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 {
+    public void testParameterizedDefaultMessageWithPackage() {
         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);
     }
@@ -270,20 +263,18 @@ public class StrutsLocalizedTextProviderTest extends XWorkTestCase {
      */
     public void testLocalizedTextProviderClearingMethods() {
         TestStrutsLocalizedTextProvider testStrutsLocalizedTextProvider = new TestStrutsLocalizedTextProvider();
-        assertTrue("testStrutsLocalizedTextProvider not instance of AbstractLocalizedTextProvider ?",
-            testStrutsLocalizedTextProvider instanceof AbstractLocalizedTextProvider);
         assertEquals("testStrutsLocalizedTextProvider starting default bundle map size not 0 before any retrievals ?",
-            0, testStrutsLocalizedTextProvider.currentBundlesMapSize());
+                0, testStrutsLocalizedTextProvider.currentBundlesMapSize());
 
         // Access the two default bundles to populate their cache entries and test bundle map size.
         ResourceBundle tempBundle = testStrutsLocalizedTextProvider.findResourceBundle(
-            TestStrutsLocalizedTextProvider.XWORK_MESSAGES_BUNDLE, Locale.ENGLISH);
+                TestStrutsLocalizedTextProvider.XWORK_MESSAGES_BUNDLE, Locale.ENGLISH);
         assertNotNull("XWORK_MESSAGES_BUNDLE retrieval null ?", tempBundle);
         tempBundle = testStrutsLocalizedTextProvider.findResourceBundle(
-            TestStrutsLocalizedTextProvider.STRUTS_MESSAGES_BUNDLE, Locale.ENGLISH);
+                TestStrutsLocalizedTextProvider.STRUTS_MESSAGES_BUNDLE, Locale.ENGLISH);
         assertNotNull("STRUTS_MESSAGES_BUNDLE retrieval null ?", tempBundle);
         assertEquals("testStrutsLocalizedTextProvider bundle map size not 2 after retrievals ?",
-            2, testStrutsLocalizedTextProvider.currentBundlesMapSize());
+                2, testStrutsLocalizedTextProvider.currentBundlesMapSize());
 
         // Add and then access four test bundles to populate their cache entries and test bundle map size.
         testStrutsLocalizedTextProvider.addDefaultResourceBundle("org/apache/struts2/util/LocalizedTextUtilTest");
@@ -291,34 +282,34 @@ public class StrutsLocalizedTextProviderTest extends XWorkTestCase {
         testStrutsLocalizedTextProvider.addDefaultResourceBundle("org/apache/struts2/SimpleAction");
         testStrutsLocalizedTextProvider.addDefaultResourceBundle("org/apache/struts2/test");
         tempBundle = testStrutsLocalizedTextProvider.findResourceBundle(
-            "org/apache/struts2/util/LocalizedTextUtilTest", Locale.ENGLISH);
+                "org/apache/struts2/util/LocalizedTextUtilTest", Locale.ENGLISH);
         assertNotNull("org/apache/struts2/util/LocalizedTextUtilTest retrieval null ?", tempBundle);
         tempBundle = testStrutsLocalizedTextProvider.findResourceBundle(
-            "org/apache/struts2/util/FindMe", Locale.ENGLISH);
+                "org/apache/struts2/util/FindMe", Locale.ENGLISH);
         assertNotNull("org/apache/struts2/util/FindMe retrieval null ?", tempBundle);
         tempBundle = testStrutsLocalizedTextProvider.findResourceBundle(
-            "org/apache/struts2/SimpleAction", Locale.ENGLISH);
+                "org/apache/struts2/SimpleAction", Locale.ENGLISH);
         assertNotNull("org/apache/struts2/SimpleAction retrieval null ?", tempBundle);
         tempBundle = testStrutsLocalizedTextProvider.findResourceBundle(
-            "org/apache/struts2/test", Locale.ENGLISH);
+                "org/apache/struts2/test", Locale.ENGLISH);
         assertNotNull("org/apache/struts2/test retrieval null ?", tempBundle);
         assertEquals("testStrutsLocalizedTextProvider bundle map size not 6 after retrievals ?",
-            6, testStrutsLocalizedTextProvider.currentBundlesMapSize());
+                6, testStrutsLocalizedTextProvider.currentBundlesMapSize());
 
         // Expect the call to function with bundle name + locale.  Remove all four of the non-default
         //   bundles and confirm the bundle map size changes.
         testStrutsLocalizedTextProvider.callClearBundleWithLocale("org/apache/struts2/test", Locale.ENGLISH);
         assertEquals("testStrutsLocalizedTextProvider bundle map size not 5 after locale clear call ?",
-            5, testStrutsLocalizedTextProvider.currentBundlesMapSize());
+                5, testStrutsLocalizedTextProvider.currentBundlesMapSize());
         testStrutsLocalizedTextProvider.callClearBundleWithLocale("org/apache/struts2/SimpleAction", Locale.ENGLISH);
         assertEquals("testStrutsLocalizedTextProvider bundle map size not 4 after locale clear call ?",
-            4, testStrutsLocalizedTextProvider.currentBundlesMapSize());
+                4, testStrutsLocalizedTextProvider.currentBundlesMapSize());
         testStrutsLocalizedTextProvider.callClearBundleWithLocale("org/apache/struts2/util/FindMe", Locale.ENGLISH);
         assertEquals("testStrutsLocalizedTextProvider bundle map size not 3 after locale clear call ?",
-            3, testStrutsLocalizedTextProvider.currentBundlesMapSize());
+                3, testStrutsLocalizedTextProvider.currentBundlesMapSize());
         testStrutsLocalizedTextProvider.callClearBundleWithLocale("org/apache/struts2/util/LocalizedTextUtilTest", Locale.ENGLISH);
         assertEquals("testStrutsLocalizedTextProvider bundle map size not 2 after locale clear call ?",
-            2, testStrutsLocalizedTextProvider.currentBundlesMapSize());
+                2, testStrutsLocalizedTextProvider.currentBundlesMapSize());
 
         // Confirm the missing bundles cache clearing method does not produce any Exceptions or failures.
         testStrutsLocalizedTextProvider.callClearMissingBundlesCache();
@@ -332,20 +323,18 @@ public class StrutsLocalizedTextProviderTest extends XWorkTestCase {
      */
     public void testLocalizedTextProviderReloadMethods() {
         TestStrutsLocalizedTextProvider testStrutsLocalizedTextProvider = new TestStrutsLocalizedTextProvider();
-        assertTrue("testStrutsLocalizedTextProvider not instance of AbstractLocalizedTextProvider ?",
-            testStrutsLocalizedTextProvider instanceof AbstractLocalizedTextProvider);
         assertEquals("testStrutsLocalizedTextProvider starting default bundle map size not 0 before any retrievals ?",
-            0, testStrutsLocalizedTextProvider.currentBundlesMapSize());
+                0, testStrutsLocalizedTextProvider.currentBundlesMapSize());
 
         // Access the two default bundles to populate their cache entries and test bundle map size.
         ResourceBundle tempBundle = testStrutsLocalizedTextProvider.findResourceBundle(
-            TestStrutsLocalizedTextProvider.XWORK_MESSAGES_BUNDLE, Locale.ENGLISH);
+                TestStrutsLocalizedTextProvider.XWORK_MESSAGES_BUNDLE, Locale.ENGLISH);
         assertNotNull("XWORK_MESSAGES_BUNDLE retrieval null ?", tempBundle);
         tempBundle = testStrutsLocalizedTextProvider.findResourceBundle(
-            TestStrutsLocalizedTextProvider.STRUTS_MESSAGES_BUNDLE, Locale.ENGLISH);
+                TestStrutsLocalizedTextProvider.STRUTS_MESSAGES_BUNDLE, Locale.ENGLISH);
         assertNotNull("STRUTS_MESSAGES_BUNDLE retrieval null ?", tempBundle);
         assertEquals("testStrutsLocalizedTextProvider bundle map size not 2 after retrievals ?",
-            2, testStrutsLocalizedTextProvider.currentBundlesMapSize());
+                2, testStrutsLocalizedTextProvider.currentBundlesMapSize());
 
         // Force a bundle reload call for code coverage and to confirm it causes the bundle map to be emptied.
         assertNotNull("ActionContext is somehow null ?", ActionContext.getContext());
@@ -355,17 +344,17 @@ public class StrutsLocalizedTextProviderTest extends XWorkTestCase {
         boolean bundlesReloadedAfterCall = testStrutsLocalizedTextProvider.getBundlesReloadedIndicatorValue();
         assertTrue("Bundles reload value false after forced reload ?", bundlesReloadedAfterCall);
         assertEquals("testStrutsLocalizedTextProvider bundle map size not 0 after reload (which should clear it) ?",
-            0, testStrutsLocalizedTextProvider.currentBundlesMapSize());
+                0, testStrutsLocalizedTextProvider.currentBundlesMapSize());
 
         // Access the two default bundles again (after reload) to populate their cache entries and test bundle map size.
         tempBundle = testStrutsLocalizedTextProvider.findResourceBundle(
-            TestStrutsLocalizedTextProvider.XWORK_MESSAGES_BUNDLE, Locale.ENGLISH);
+                TestStrutsLocalizedTextProvider.XWORK_MESSAGES_BUNDLE, Locale.ENGLISH);
         assertNotNull("XWORK_MESSAGES_BUNDLE retrieval null ?", tempBundle);
         tempBundle = testStrutsLocalizedTextProvider.findResourceBundle(
-            TestStrutsLocalizedTextProvider.STRUTS_MESSAGES_BUNDLE, Locale.ENGLISH);
+                TestStrutsLocalizedTextProvider.STRUTS_MESSAGES_BUNDLE, Locale.ENGLISH);
         assertNotNull("STRUTS_MESSAGES_BUNDLE retrieval null ?", tempBundle);
         assertEquals("testStrutsLocalizedTextProvider bundle map size not 2 after retrievals ?",
-            2, testStrutsLocalizedTextProvider.currentBundlesMapSize());
+                2, testStrutsLocalizedTextProvider.currentBundlesMapSize());
     }
 
     /**
@@ -391,7 +380,7 @@ public class StrutsLocalizedTextProviderTest extends XWorkTestCase {
         final String DEFAULT_MESSAGE_WITH_PARAMS = DEFAULT_MESSAGE + "  We provide a couple of parameter placeholders: -{0}- and -{1}- for fun.";
         final String param1 = "param1_String";
         final String param2 = "param2_String";
-        final String[] paramArray = { param1, param2 };
+        final String[] paramArray = {param1, param2};
         TestStrutsLocalizedTextProvider testStrutsLocalizedTextProvider = new TestStrutsLocalizedTextProvider();
 
         // Load some specific default bundles already provided and used by other tests within this module.
@@ -457,7 +446,7 @@ public class StrutsLocalizedTextProviderTest extends XWorkTestCase {
     /**
      * Test the {@link StrutsLocalizedTextProvider#findText(java.lang.Class, java.lang.String, java.util.Locale, java.lang.String, java.lang.Object[], org.apache.struts2.util.ValueStack) }
      * method for basic correctness.
-     *
+     * <p>
      * It is the version of the method that will search the class hierarchy resource bundles first, unless {@link StrutsLocalizedTextProvider#searchDefaultBundlesFirst}
      * is true (in which case it will search the default resource bundles first).  No matter the flag setting, it should search until it finds a match, or fails to find
      * a match and returns the default message parameter that was passed.
@@ -469,7 +458,7 @@ public class StrutsLocalizedTextProviderTest extends XWorkTestCase {
         final String DEFAULT_MESSAGE_WITH_PARAMS = DEFAULT_MESSAGE + "  We provide a couple of parameter placeholders: -{0}- and -{1}- for fun.";
         final String param1 = "param1_String";
         final String param2 = "param2_String";
-        final String[] paramArray = { param1, param2 };
+        final String[] paramArray = {param1, param2};
         TestStrutsLocalizedTextProvider testStrutsLocalizedTextProvider = new TestStrutsLocalizedTextProvider();
 
         // Load some specific default bundles already provided and used by other tests within this module.
@@ -585,7 +574,7 @@ public class StrutsLocalizedTextProviderTest extends XWorkTestCase {
 
         /**
          * Some test correctness depends on this {@link #RELOADED} value matching that of the private ancestor
-         * field {@link AbstractLocalizedTextProvider#RELOADED}.  If the ancestor field value changes, ensure this
+         * field {@link AbstractLocalizedTextProvider#RELOADED}. If the ancestor field value changes, ensure this
          * field's value is updated to match it exactly.
          */
         private static final String RELOADED = "org.apache.struts2.util.LocalizedTextProvider.reloaded";
diff --git a/core/src/test/java/org/apache/struts2/StubTextProvider.java b/core/src/test/java/org/apache/struts2/text/StubTextProvider.java
similarity index 98%
rename from core/src/test/java/org/apache/struts2/StubTextProvider.java
rename to core/src/test/java/org/apache/struts2/text/StubTextProvider.java
index 0ef1899b0..a55ec4bf9 100644
--- a/core/src/test/java/org/apache/struts2/StubTextProvider.java
+++ b/core/src/test/java/org/apache/struts2/text/StubTextProvider.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.struts2;
+package org.apache.struts2.text;
 
 import org.apache.struts2.util.ValueStack;
 
diff --git a/core/src/test/java/org/apache/struts2/TextProviderSupportTest.java b/core/src/test/java/org/apache/struts2/text/TextProviderSupportTest.java
similarity index 88%
rename from core/src/test/java/org/apache/struts2/TextProviderSupportTest.java
rename to core/src/test/java/org/apache/struts2/text/TextProviderSupportTest.java
index dd0bddb7b..612c5165f 100644
--- a/core/src/test/java/org/apache/struts2/TextProviderSupportTest.java
+++ b/core/src/test/java/org/apache/struts2/text/TextProviderSupportTest.java
@@ -16,29 +16,27 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.struts2;
+package org.apache.struts2.text;
+
+import org.apache.struts2.LocaleProvider;
+import org.apache.struts2.XWorkTestCase;
 
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
 import java.util.ResourceBundle;
 
-/**
- * Unit test for {@link TextProviderSupport}.
- *
- * @author Claus Ibsen
- */
 public class TextProviderSupportTest extends XWorkTestCase {
 
     private TextProviderSupport tp;
     private java.util.ResourceBundle rb;
 
-    public void testHasKey() throws Exception {
-    	assertTrue(tp.hasKey("hello"));
-    	assertFalse(tp.hasKey("not.in.bundle"));
+    public void testHasKey() {
+        assertTrue(tp.hasKey("hello"));
+        assertFalse(tp.hasKey("not.in.bundle"));
     }
 
-    public void testSimpleGetTexts() throws Exception {
+    public void testSimpleGetTexts() {
         assertEquals("Hello World", tp.getText("hello"));
         assertEquals("not.in.bundle", tp.getText("not.in.bundle"));
 
@@ -46,7 +44,7 @@ public class TextProviderSupportTest extends XWorkTestCase {
         assertEquals("this is default", tp.getText("not.in.bundle", "this is default"));
     }
 
-    public void testGetTextsWithArgs() throws Exception {
+    public void testGetTextsWithArgs() {
         assertEquals("Hello World", tp.getText("hello", "this is default", "from me")); // no args in bundle
         assertEquals("Hello World from me", tp.getText("hello.0", "this is default", "from me"));
         assertEquals("this is default", tp.getText("not.in.bundle", "this is default", "from me"));
@@ -55,7 +53,7 @@ public class TextProviderSupportTest extends XWorkTestCase {
         assertEquals("not.in.bundle", tp.getText("not.in.bundle"));
     }
 
-    public void testGetTextsWithListArgs() throws Exception {
+    public void testGetTextsWithListArgs() {
         List<Object> args = new ArrayList<>();
         args.add("Santa");
         args.add("loud");
@@ -74,8 +72,8 @@ public class TextProviderSupportTest extends XWorkTestCase {
         assertEquals("not.in.bundle", tp.getText("not.in.bundle", args));
     }
 
-    public void testGetTextsWithArrayArgs() throws Exception {
-        String[] args = { "Santa", "loud" };
+    public void testGetTextsWithArrayArgs() {
+        String[] args = {"Santa", "loud"};
         assertEquals("Hello World", tp.getText("hello", "this is default", args)); // no args in bundle
         assertEquals("Hello World Santa", tp.getText("hello.0", "this is default", args)); // only 1 arg in bundle
         assertEquals("Hello World. This is Santa speaking loud", tp.getText("hello.1", "this is default", args));
@@ -91,18 +89,18 @@ public class TextProviderSupportTest extends XWorkTestCase {
         assertEquals("not.in.bundle", tp.getText("not.in.bundle", args));
     }
 
-    public void testGetBundle() throws Exception {
+    public void testGetBundle() {
         assertEquals(rb, tp.getTexts());
         assertEquals(rb, tp.getTexts(TextProviderSupportTest.class.getName()));
     }
 
     public void testDifficultSymbols1() {
-        String val= tp.getText("symbols1");
+        String val = tp.getText("symbols1");
         assertEquals("\"=!@#$%^&*(){qwe}<>?:|}{[]\\';/.,<>`~'", val);
     }
 
     public void testDifficultSymbols2() {
-        String val= tp.getText("symbols2");
+        String val = tp.getText("symbols2");
         assertEquals("\"=!@#$%^&*()<>?:|[]\\';/.,<>`~'", val);
     }
 
@@ -132,6 +130,7 @@ public class TextProviderSupportTest extends XWorkTestCase {
 
     @Override
     protected void tearDown() throws Exception {
+        super.tearDown();
         rb = null;
         tp = null;
     }
diff --git a/core/src/test/java/org/apache/struts2/validator/AnnotationActionValidatorManagerTest.java b/core/src/test/java/org/apache/struts2/validator/AnnotationActionValidatorManagerTest.java
index 39065c933..029606409 100644
--- a/core/src/test/java/org/apache/struts2/validator/AnnotationActionValidatorManagerTest.java
+++ b/core/src/test/java/org/apache/struts2/validator/AnnotationActionValidatorManagerTest.java
@@ -27,7 +27,7 @@ import org.apache.struts2.FileManager;
 import org.apache.struts2.FileManagerFactory;
 import org.apache.struts2.SimpleAction;
 import org.apache.struts2.SimpleAnnotationAction;
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.XWorkTestCase;
 import org.apache.struts2.config.entities.ActionConfig;
 import org.apache.struts2.test.AnnotationDataAware2;
diff --git a/core/src/test/java/org/apache/struts2/validator/ConversionErrorFieldValidatorTest.java b/core/src/test/java/org/apache/struts2/validator/ConversionErrorFieldValidatorTest.java
index 0d814469b..39a944081 100644
--- a/core/src/test/java/org/apache/struts2/validator/ConversionErrorFieldValidatorTest.java
+++ b/core/src/test/java/org/apache/struts2/validator/ConversionErrorFieldValidatorTest.java
@@ -19,7 +19,7 @@
 package org.apache.struts2.validator;
 
 import org.apache.struts2.ActionContext;
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.interceptor.ValidationAware;
 import org.apache.struts2.ValidationAwareSupport;
 import org.apache.struts2.XWorkTestCase;
diff --git a/core/src/test/java/org/apache/struts2/validator/DoubleRangeFieldValidatorTest.java b/core/src/test/java/org/apache/struts2/validator/DoubleRangeFieldValidatorTest.java
index 660b003ce..522a58bec 100644
--- a/core/src/test/java/org/apache/struts2/validator/DoubleRangeFieldValidatorTest.java
+++ b/core/src/test/java/org/apache/struts2/validator/DoubleRangeFieldValidatorTest.java
@@ -21,7 +21,7 @@ package org.apache.struts2.validator;
 import org.apache.struts2.ActionContext;
 import org.apache.struts2.ActionProxy;
 import org.apache.struts2.ActionSupport;
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.ValidationAwareSupport;
 import org.apache.struts2.XWorkTestCase;
 import org.apache.struts2.config.providers.MockConfigurationProvider;
diff --git a/core/src/test/java/org/apache/struts2/validator/DummyValidatorContext.java b/core/src/test/java/org/apache/struts2/validator/DummyValidatorContext.java
index f386a03cd..e80d1c183 100644
--- a/core/src/test/java/org/apache/struts2/validator/DummyValidatorContext.java
+++ b/core/src/test/java/org/apache/struts2/validator/DummyValidatorContext.java
@@ -18,7 +18,7 @@
  */
 package org.apache.struts2.validator;
 
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProviderFactory;
 
 import java.util.*;
 
diff --git a/core/src/test/java/org/apache/struts2/validator/EmailValidatorTest.java b/core/src/test/java/org/apache/struts2/validator/EmailValidatorTest.java
index 663b96c19..6ad78e01a 100644
--- a/core/src/test/java/org/apache/struts2/validator/EmailValidatorTest.java
+++ b/core/src/test/java/org/apache/struts2/validator/EmailValidatorTest.java
@@ -20,7 +20,7 @@ package org.apache.struts2.validator;
 
 import org.apache.struts2.ActionContext;
 import org.apache.struts2.ActionSupport;
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.XWorkTestCase;
 import org.apache.struts2.util.ValueStack;
 import org.apache.struts2.validator.validators.EmailValidator;
diff --git a/core/src/test/java/org/apache/struts2/validator/ExpressionValidatorTest.java b/core/src/test/java/org/apache/struts2/validator/ExpressionValidatorTest.java
index bb4bd4f85..49c0543fa 100644
--- a/core/src/test/java/org/apache/struts2/validator/ExpressionValidatorTest.java
+++ b/core/src/test/java/org/apache/struts2/validator/ExpressionValidatorTest.java
@@ -25,7 +25,7 @@ import org.apache.struts2.ActionContext;
 import org.apache.struts2.ActionInvocation;
 import org.apache.struts2.ActionProxy;
 import org.apache.struts2.TestBean;
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.ValidationAwareSupport;
 import org.apache.struts2.XWorkTestCase;
 import org.apache.struts2.config.entities.ActionConfig;
diff --git a/core/src/test/java/org/apache/struts2/validator/RegexFieldValidatorTest.java b/core/src/test/java/org/apache/struts2/validator/RegexFieldValidatorTest.java
index a7b99ea10..c2988efa0 100644
--- a/core/src/test/java/org/apache/struts2/validator/RegexFieldValidatorTest.java
+++ b/core/src/test/java/org/apache/struts2/validator/RegexFieldValidatorTest.java
@@ -19,9 +19,8 @@
 package org.apache.struts2.validator;
 
 import org.apache.struts2.ActionContext;
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.XWorkTestCase;
-import org.apache.struts2.util.ValueStack;
 import org.apache.struts2.validator.validators.RegexFieldValidator;
 
 import java.util.Arrays;
diff --git a/core/src/test/java/org/apache/struts2/validator/RepopulateConversionErrorFieldValidatorSupportTest.java b/core/src/test/java/org/apache/struts2/validator/RepopulateConversionErrorFieldValidatorSupportTest.java
index e9d96e71d..4a1d7bf82 100644
--- a/core/src/test/java/org/apache/struts2/validator/RepopulateConversionErrorFieldValidatorSupportTest.java
+++ b/core/src/test/java/org/apache/struts2/validator/RepopulateConversionErrorFieldValidatorSupportTest.java
@@ -20,7 +20,7 @@ package org.apache.struts2.validator;
 
 import org.apache.struts2.ActionContext;
 import org.apache.struts2.ActionSupport;
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.XWorkTestCase;
 import org.apache.struts2.conversion.impl.ConversionData;
 import org.apache.struts2.mock.MockActionInvocation;
diff --git a/core/src/test/java/org/apache/struts2/validator/SimpleActionValidationTest.java b/core/src/test/java/org/apache/struts2/validator/SimpleActionValidationTest.java
index 077c0b51f..a3a4fde3f 100644
--- a/core/src/test/java/org/apache/struts2/validator/SimpleActionValidationTest.java
+++ b/core/src/test/java/org/apache/struts2/validator/SimpleActionValidationTest.java
@@ -21,9 +21,7 @@ package org.apache.struts2.validator;
 import org.apache.struts2.ActionContext;
 import org.apache.struts2.ActionProxy;
 import org.apache.struts2.SimpleAction;
-import org.apache.struts2.StubTextProvider;
-import org.apache.struts2.StubValueStack;
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.XWorkTestCase;
 import org.apache.struts2.config.providers.MockConfigurationProvider;
 import org.apache.struts2.config.providers.XmlConfigurationProvider;
diff --git a/core/src/test/java/org/apache/struts2/validator/StringLengthFieldValidatorTest.java b/core/src/test/java/org/apache/struts2/validator/StringLengthFieldValidatorTest.java
index 9183a773e..1d38b2dbe 100644
--- a/core/src/test/java/org/apache/struts2/validator/StringLengthFieldValidatorTest.java
+++ b/core/src/test/java/org/apache/struts2/validator/StringLengthFieldValidatorTest.java
@@ -20,7 +20,7 @@ package org.apache.struts2.validator;
 
 import org.apache.struts2.ActionContext;
 import org.apache.struts2.ActionSupport;
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.XWorkTestCase;
 import org.apache.struts2.util.ValueStack;
 import org.apache.struts2.validator.validators.StringLengthFieldValidator;
diff --git a/core/src/test/java/org/apache/struts2/validator/StringValidatorTest.java b/core/src/test/java/org/apache/struts2/validator/StringValidatorTest.java
index d052b4aea..5583c500b 100644
--- a/core/src/test/java/org/apache/struts2/validator/StringValidatorTest.java
+++ b/core/src/test/java/org/apache/struts2/validator/StringValidatorTest.java
@@ -22,7 +22,7 @@ import org.apache.struts2.action.Action;
 import org.apache.struts2.ActionContext;
 import org.apache.struts2.ActionInvocation;
 import org.apache.struts2.ActionProxy;
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.ValidationAwareSupport;
 import org.apache.struts2.XWorkTestCase;
 import org.apache.struts2.config.entities.ActionConfig;
diff --git a/core/src/test/java/org/apache/struts2/validator/URLValidatorTest.java b/core/src/test/java/org/apache/struts2/validator/URLValidatorTest.java
index cdad9db37..1d3a60d13 100644
--- a/core/src/test/java/org/apache/struts2/validator/URLValidatorTest.java
+++ b/core/src/test/java/org/apache/struts2/validator/URLValidatorTest.java
@@ -19,7 +19,7 @@
 package org.apache.struts2.validator;
 
 import org.apache.struts2.ActionContext;
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.XWorkTestCase;
 import org.apache.struts2.util.ValueStack;
 import org.apache.struts2.validator.validators.URLValidator;
diff --git a/core/src/test/java/org/apache/struts2/validator/validators/AppendingValidatorContextTest.java b/core/src/test/java/org/apache/struts2/validator/validators/AppendingValidatorContextTest.java
index d1875bb19..a1a68064d 100644
--- a/core/src/test/java/org/apache/struts2/validator/validators/AppendingValidatorContextTest.java
+++ b/core/src/test/java/org/apache/struts2/validator/validators/AppendingValidatorContextTest.java
@@ -22,9 +22,9 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.struts2.CompositeTextProvider;
-import org.apache.struts2.TextProvider;
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.CompositeTextProvider;
+import org.apache.struts2.text.TextProvider;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.XWorkTestCase;
 import org.apache.struts2.validator.DelegatingValidatorContext;
 import org.apache.struts2.validator.ValidatorContext;
diff --git a/core/src/test/java/org/apache/struts2/validator/validators/CreditCardValidatorTest.java b/core/src/test/java/org/apache/struts2/validator/validators/CreditCardValidatorTest.java
index 0b16d5d4d..bd5fc672b 100644
--- a/core/src/test/java/org/apache/struts2/validator/validators/CreditCardValidatorTest.java
+++ b/core/src/test/java/org/apache/struts2/validator/validators/CreditCardValidatorTest.java
@@ -18,7 +18,7 @@
  */
 package org.apache.struts2.validator.validators;
 
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.util.ValueStack;
 import org.apache.struts2.util.ValueStackFactory;
 import org.apache.struts2.validator.DummyValidatorContext;
diff --git a/core/src/test/java/org/apache/struts2/validator/validators/DateRangeFieldValidatorTest.java b/core/src/test/java/org/apache/struts2/validator/validators/DateRangeFieldValidatorTest.java
index a5e49566e..0168a0ac3 100644
--- a/core/src/test/java/org/apache/struts2/validator/validators/DateRangeFieldValidatorTest.java
+++ b/core/src/test/java/org/apache/struts2/validator/validators/DateRangeFieldValidatorTest.java
@@ -19,7 +19,7 @@
 package org.apache.struts2.validator.validators;
 
 import org.apache.struts2.ActionContext;
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.XWorkTestCase;
 import org.apache.struts2.util.ValueStack;
 import org.apache.struts2.util.ValueStackFactory;
diff --git a/core/src/test/java/org/apache/struts2/validator/validators/IntRangeFieldValidatorTest.java b/core/src/test/java/org/apache/struts2/validator/validators/IntRangeFieldValidatorTest.java
index a211cb6e6..116b23e98 100644
--- a/core/src/test/java/org/apache/struts2/validator/validators/IntRangeFieldValidatorTest.java
+++ b/core/src/test/java/org/apache/struts2/validator/validators/IntRangeFieldValidatorTest.java
@@ -18,7 +18,7 @@
  */
 package org.apache.struts2.validator.validators;
 
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.XWorkTestCase;
 import org.apache.struts2.util.ValueStack;
 import org.apache.struts2.util.ValueStackFactory;
diff --git a/core/src/test/java/org/apache/struts2/validator/validators/LongRangeFieldValidatorTest.java b/core/src/test/java/org/apache/struts2/validator/validators/LongRangeFieldValidatorTest.java
index 2d9953a9d..028661f61 100644
--- a/core/src/test/java/org/apache/struts2/validator/validators/LongRangeFieldValidatorTest.java
+++ b/core/src/test/java/org/apache/struts2/validator/validators/LongRangeFieldValidatorTest.java
@@ -18,7 +18,7 @@
  */
 package org.apache.struts2.validator.validators;
 
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.XWorkTestCase;
 import org.apache.struts2.util.ValueStack;
 import org.apache.struts2.util.ValueStackFactory;
diff --git a/core/src/test/java/org/apache/struts2/validator/validators/RequiredFieldValidatorTest.java b/core/src/test/java/org/apache/struts2/validator/validators/RequiredFieldValidatorTest.java
index 6755ca591..26c6fef99 100644
--- a/core/src/test/java/org/apache/struts2/validator/validators/RequiredFieldValidatorTest.java
+++ b/core/src/test/java/org/apache/struts2/validator/validators/RequiredFieldValidatorTest.java
@@ -19,7 +19,7 @@
 package org.apache.struts2.validator.validators;
 
 import org.apache.struts2.ActionContext;
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.validator.DummyValidatorContext;
 import org.apache.struts2.StrutsInternalTestCase;
 import org.junit.Test;
diff --git a/core/src/test/java/org/apache/struts2/validator/validators/RequiredStringValidatorTest.java b/core/src/test/java/org/apache/struts2/validator/validators/RequiredStringValidatorTest.java
index 22ba2d331..94fb64d76 100644
--- a/core/src/test/java/org/apache/struts2/validator/validators/RequiredStringValidatorTest.java
+++ b/core/src/test/java/org/apache/struts2/validator/validators/RequiredStringValidatorTest.java
@@ -20,7 +20,7 @@ package org.apache.struts2.validator.validators;
 
 import org.apache.struts2.ActionContext;
 import org.apache.struts2.ActionSupport;
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.XWorkTestCase;
 import org.apache.struts2.util.ValueStack;
 import org.apache.struts2.validator.DummyValidatorContext;
diff --git a/core/src/test/java/org/apache/struts2/validator/validators/ShortRangeFieldValidatorTest.java b/core/src/test/java/org/apache/struts2/validator/validators/ShortRangeFieldValidatorTest.java
index 71871e0f0..1cef8c585 100644
--- a/core/src/test/java/org/apache/struts2/validator/validators/ShortRangeFieldValidatorTest.java
+++ b/core/src/test/java/org/apache/struts2/validator/validators/ShortRangeFieldValidatorTest.java
@@ -18,7 +18,7 @@
  */
 package org.apache.struts2.validator.validators;
 
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.XWorkTestCase;
 import org.apache.struts2.util.ValueStack;
 import org.apache.struts2.util.ValueStackFactory;
diff --git a/core/src/test/resources/org/apache/struts2/DefaultTextProviderTest_en_CA.properties b/core/src/test/resources/org/apache/struts2/text/DefaultTextProviderTest_en_CA.properties
similarity index 100%
rename from core/src/test/resources/org/apache/struts2/DefaultTextProviderTest_en_CA.properties
rename to core/src/test/resources/org/apache/struts2/text/DefaultTextProviderTest_en_CA.properties
diff --git a/core/src/test/resources/org/apache/struts2/TextProviderSupportTest_en.properties b/core/src/test/resources/org/apache/struts2/text/TextProviderSupportTest_en.properties
similarity index 100%
rename from core/src/test/resources/org/apache/struts2/TextProviderSupportTest_en.properties
rename to core/src/test/resources/org/apache/struts2/text/TextProviderSupportTest_en.properties
diff --git a/plugins/bean-validation/src/main/java/org/apache/struts/beanvalidation/validation/interceptor/BeanValidationInterceptor.java b/plugins/bean-validation/src/main/java/org/apache/struts/beanvalidation/validation/interceptor/BeanValidationInterceptor.java
index 95d95108a..546c69525 100644
--- a/plugins/bean-validation/src/main/java/org/apache/struts/beanvalidation/validation/interceptor/BeanValidationInterceptor.java
+++ b/plugins/bean-validation/src/main/java/org/apache/struts/beanvalidation/validation/interceptor/BeanValidationInterceptor.java
@@ -21,7 +21,7 @@ package org.apache.struts.beanvalidation.validation.interceptor;
 import org.apache.struts2.ActionInvocation;
 import org.apache.struts2.ActionProxy;
 import org.apache.struts2.ModelDriven;
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.inject.Inject;
 import org.apache.struts2.interceptor.MethodFilterInterceptor;
 import org.apache.struts2.validator.DelegatingValidatorContext;
diff --git a/plugins/spring/src/test/java/org/apache/struts2/mock/DummyTextProvider.java b/plugins/spring/src/test/java/org/apache/struts2/mock/DummyTextProvider.java
index 9694a0c5f..a76993680 100644
--- a/plugins/spring/src/test/java/org/apache/struts2/mock/DummyTextProvider.java
+++ b/plugins/spring/src/test/java/org/apache/struts2/mock/DummyTextProvider.java
@@ -18,7 +18,7 @@
  */
  package org.apache.struts2.mock;
 
-import org.apache.struts2.TextProvider;
+import org.apache.struts2.text.TextProvider;
 import org.apache.struts2.util.ValueStack;
 
 import java.util.List;
diff --git a/plugins/spring/src/test/java/org/apache/struts2/spring/SpringObjectFactoryTest.java b/plugins/spring/src/test/java/org/apache/struts2/spring/SpringObjectFactoryTest.java
index 01990e59a..0e3e68308 100644
--- a/plugins/spring/src/test/java/org/apache/struts2/spring/SpringObjectFactoryTest.java
+++ b/plugins/spring/src/test/java/org/apache/struts2/spring/SpringObjectFactoryTest.java
@@ -25,7 +25,7 @@ import org.apache.struts2.ModelDrivenAction;
 import org.apache.struts2.ObjectFactory;
 import org.apache.struts2.SimpleAction;
 import org.apache.struts2.TestBean;
-import org.apache.struts2.TextProvider;
+import org.apache.struts2.text.TextProvider;
 import org.apache.struts2.XWorkTestCase;
 import org.apache.struts2.config.ConfigurationException;
 import org.apache.struts2.config.entities.ActionConfig;
diff --git a/plugins/tiles/src/main/java/org/apache/struts2/tiles/I18NAttributeEvaluator.java b/plugins/tiles/src/main/java/org/apache/struts2/tiles/I18NAttributeEvaluator.java
index 9844596e6..2c37e0da2 100644
--- a/plugins/tiles/src/main/java/org/apache/struts2/tiles/I18NAttributeEvaluator.java
+++ b/plugins/tiles/src/main/java/org/apache/struts2/tiles/I18NAttributeEvaluator.java
@@ -19,8 +19,8 @@
 package org.apache.struts2.tiles;
 
 import org.apache.struts2.ActionContext;
-import org.apache.struts2.TextProvider;
-import org.apache.struts2.TextProviderFactory;
+import org.apache.struts2.text.TextProvider;
+import org.apache.struts2.text.TextProviderFactory;
 import org.apache.struts2.config.ConfigurationException;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;