commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r557873 - /jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/LazyDynaBean.java
Date Fri, 20 Jul 2007 05:36:29 GMT
Author: niallp
Date: Thu Jul 19 22:36:28 2007
New Revision: 557873

URL: http://svn.apache.org/viewvc?view=rev&rev=557873
Log:
Check the DynaProperty content type for List properties

Modified:
    jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/LazyDynaBean.java

Modified: jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/LazyDynaBean.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/LazyDynaBean.java?view=diff&rev=557873&r1=557872&r2=557873
==============================================================================
--- jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/LazyDynaBean.java
(original)
+++ jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/LazyDynaBean.java
Thu Jul 19 22:36:28 2007
@@ -598,7 +598,12 @@
 
             List list = (List)indexedProperty;
             while (index >= list.size()) {
-                list.add(null);
+                Class contentType = getDynaClass().getDynaProperty(name).getContentType();
+                Object value = null;
+                if (contentType != null) {
+                    value = createProperty(name+"["+list.size()+"]", contentType);
+                }
+                list.add(value);
             }
 
         }
@@ -631,6 +636,9 @@
      * @return The new value
      */
     protected Object createProperty(String name, Class type) {
+        if (type == null) {
+            return null;
+        }
 
         // Create Lists, arrays or DynaBeans
         if (type.isArray() || List.class.isAssignableFrom(type)) {



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message