Commits

plightbo  committed 23f9c2c

various little bug fixes and stuff

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

  • Participants
  • Parent commits 3f16179

Comments (0)

Files changed (2)

File src/java/com/opensymphony/xwork/TextProviderSupport.java

      * @return     value of named text
      */
     public String getText(String aTextName, String defaultValue, List args) {
+        Object[] argsArray = (args != null ? args.toArray() : null);
         if (clazz != null) {
-            return LocalizedTextUtil.findText(clazz, aTextName, getLocale(), defaultValue, args.toArray());
+            return LocalizedTextUtil.findText(clazz, aTextName, getLocale(),
+                    defaultValue, argsArray);
+        } else {
+            return LocalizedTextUtil.findText(bundle, aTextName, getLocale(),
+                    defaultValue, argsArray);
         }
-
-        return LocalizedTextUtil.findText(bundle, aTextName, getLocale(), defaultValue, args.toArray());
     }
 
     /**

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

 
 import java.lang.reflect.Member;
 
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
+import java.util.*;
 
 
 /**
     //~ Instance fields ////////////////////////////////////////////////////////
 
     HashMap defaultMappings = new HashMap();
+    HashSet unknownMappings = new HashSet();
     HashMap mappings = new HashMap();
     HashSet noMapping = new HashSet();
     TypeConverter defaultTypeConverter = new XWorkBasicConverter();
     }
 
     public TypeConverter lookup(String className) {
+        if (unknownMappings.contains(className)) {
+            return null;
+        }
+
         TypeConverter result = (TypeConverter) defaultMappings.get(className);
 
         //Looks for super classes
             if (result != null) {
                 //Register now, the next lookup will be faster
                 registerConverter(className, result);
+            } else {
+                // if it isn't found, never look again (also faster)
+                registerConverterNotFound(className);
             }
         }
 
         return lookup(clazz.getName());
     }
 
-    public void registerConverter(String className, TypeConverter converter) {
+    protected synchronized void registerConverter(String className, TypeConverter converter) {
         defaultMappings.put(className, converter);
     }
 
+    protected synchronized void registerConverterNotFound(String className) {
+        unknownMappings.add(className);
+    }
+
     protected void handleConversionException(Map context, String property, Object value, Object object) {
         if ((context.get(REPORT_CONVERSION_ERRORS) == Boolean.TRUE)) {
             String realProperty = property;