1. opensymphony
  2. xwork

Commits

unkyaku  committed bd4dd16

Cleanup logic for fix for XW-182.

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@270e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits 11a2c00
  • Branches master

Comments (0)

Files changed (1)

File src/java/com/opensymphony/xwork/util/LocalizedTextUtil.java

View file
         }
 
         // nothing still? alright, search the package hierarchy now
-        clazz = aClass;
-
-        do {
-            try {
-                if (clazz != null && clazz.getPackage() != null) {
+        for (clazz = aClass; clazz != null && !clazz.equals(Object.class); clazz = clazz.getSuperclass()) {
+            if (clazz.getPackage() != null) {
+                try {
                     String packageName = clazz.getPackage().getName();
                     ResourceBundle bundle = findResourceBundle(packageName + ".package", locale);
                     reloadBundles(bundle);
                     String message = TextParseUtil.translateVariables(bundle.getString(aTextName), valueStack);
 
                     return MessageFormat.format(message, args);
-                } else {
-                    clazz = clazz.getSuperclass();
+                } catch (MissingResourceException ex) {
                 }
-            } catch (MissingResourceException ex) {
-                clazz = clazz.getSuperclass();
             }
-        } while (!clazz.equals(Object.class));
+        }
 
         return getDefaultText(aTextName, locale, valueStack, args, defaultMessage);
     }