[ 
https://issues.apache.org/jira/browse/WW-4407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14169140#comment-14169140
 ] 

Christoph Nenning commented on WW-4407:
---------------------------------------

What do you think of doing something simple like this ?
{noformat}
    public static String findDefaultText(String aTextName, Locale locale) {
        List<String> localList = 
classLoaderMap.get(Thread.currentThread().getContextClassLoader().hashCode());

        for (String bundleName : localList) {
            ResourceBundle bundle = findResourceBundle(bundleName, locale);
            if (bundle != null) {
                reloadBundles();
                try {
                    return bundle.getString(aTextName);
                } catch (MissingResourceException e) {
                        // will be logged when not found in any bundle
                }
            }
        }

        if (devMode) {
            LOG.warn("Missing key [#0] in bundles [#1]!", aTextName, localList);
        } else if (LOG.isDebugEnabled()) {
            LOG.debug("Missing key [#0] in bundles [#1]!", aTextName, 
localList);
        }

        return null;
    }

{noformat}

> LocalizedTextUtil reports WARNings when app uses more than one resource bundle
> ------------------------------------------------------------------------------
>
>                 Key: WW-4407
>                 URL: https://issues.apache.org/jira/browse/WW-4407
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Other
>    Affects Versions: 2.3.18
>            Reporter: Christoph Nenning
>            Priority: Minor
>              Labels: i18n
>             Fix For: 2.3.x
>
>
> In my app I use 3 resource bundles. One of them is located direclty in the 
> app and contains most text keys. The other two are located in JARs that are 
> reused in several apps and bring a few own text keys.
> Each Key is defined in exactly one bundle.
> Since Version 2.3.18 LocalizedTextUtil searches each key in all bundles and 
> reports WARN messages for those bundles the key is not located in:
> WARN  opensymphony.xwork2.util.LocalizedTextUtil - Missing key [...] in 
> bundle [...]!
> Is is probably caused by WW-4379.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to