webwork/src/main/webwork/util BeanUtil.java,1.42,1.43

[email protected] Mon, 12 Dec 2005 16:29:18 +0000 (UTC)
Newsgroups gmane.comp.java.open-symphony.cvs
Message-ID <[email protected]>
Update of /cvsroot/opensymphony/webwork/src/main/webwork/util
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22253/src/main/webwork/util

Modified Files:
	BeanUtil.java 
Log Message:
Handle bean maps that contain params with empty names

Index: BeanUtil.java
===================================================================
RCS file: /cvsroot/opensymphony/webwork/src/main/webwork/util/BeanUtil.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- BeanUtil.java	17 Jan 2005 07:28:10 -0000	1.42
+++ BeanUtil.java	12 Dec 2005 16:25:40 -0000	1.43
@@ -174,25 +174,28 @@
          while (keys.hasNext())
          {
             key = (String) keys.next();
-            try
-            {
-               value = from.get(key);
-               setProperty(key, value, to, fieldMap);
-            } catch (IllegalArgumentException e)
+            if(key != null && key.length() > 0)
             {
-               // Handle IEA's on actions specially
-               if (to instanceof IllegalArgumentAware)
-               {
-                  ((IllegalArgumentAware) to).addIllegalArgumentException(key, e);
-               } else
-               {
-                  throw e;
-               }
+              try
+              {
+                 value = from.get(key);
+                 setProperty(key, value, to, fieldMap);
+              } catch (IllegalArgumentException e)
+              {
+                 // Handle IEA's on actions specially
+                 if (to instanceof IllegalArgumentAware)
+                 {
+                    ((IllegalArgumentAware) to).addIllegalArgumentException(key, e);
+                 } else
+                 {
+                    throw e;
+                 }
+              }
             }
          }
       } catch (Throwable e)
       {
-         log.warn("Could not set parameter \"" + key + "\" with value \"" + value + "\" on class " + to.getClass()+ ":" + e, e);
+         log.warn("Could not set parameter \"" + key + "\" with value \"" + value + "\" on class " + to.getClass()+ ':' + e, e);
          throw new IllegalArgumentException("Could not set parameter \"" + key + "\":" + e);
       }
    }
@@ -947,18 +950,6 @@
 
 
    /**
-    * Get a property descriptor for a given field on an object
-    *
-    * @param   property        the property that we are interested in
-    * @param   obj             the object we want the property descriptor for
-    */
-   private static PropertyDescriptor getPropertyDescriptor(String property, Object obj)
-   {
-      Map fieldMap = getFieldMapForClass(obj.getClass());
-      return (PropertyDescriptor) fieldMap.get(property);
-   }
-
-   /**
     * Get the field map for a class.  The map is used by getPropertyDescriptor.
     * If it does not exist for the class it will call buildFieldMap
     *



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click