empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject svn commit: r1301724 - /empire-db/trunk/empire-db/src/main/java/org/apache/empire/data/bean/BeanRecordProxy.java
Date Fri, 16 Mar 2012 19:56:55 GMT
Author: doebele
Date: Fri Mar 16 19:56:55 2012
New Revision: 1301724

URL: http://svn.apache.org/viewvc?rev=1301724&view=rev
Log:
EMPIREDB-126
somehow this one was missed - but its nothing crucial

Modified:
    empire-db/trunk/empire-db/src/main/java/org/apache/empire/data/bean/BeanRecordProxy.java

Modified: empire-db/trunk/empire-db/src/main/java/org/apache/empire/data/bean/BeanRecordProxy.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db/src/main/java/org/apache/empire/data/bean/BeanRecordProxy.java?rev=1301724&r1=1301723&r2=1301724&view=diff
==============================================================================
--- empire-db/trunk/empire-db/src/main/java/org/apache/empire/data/bean/BeanRecordProxy.java
(original)
+++ empire-db/trunk/empire-db/src/main/java/org/apache/empire/data/bean/BeanRecordProxy.java
Fri Mar 16 19:56:55 2012
@@ -24,6 +24,7 @@ import java.util.List;
 
 import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.beanutils.BeanUtilsBean;
+import org.apache.commons.beanutils.PropertyUtils;
 import org.apache.commons.beanutils.PropertyUtilsBean;
 import org.apache.empire.commons.ObjectUtils;
 import org.apache.empire.commons.Options;
@@ -371,9 +372,15 @@ public class BeanRecordProxy<T> implemen
         {   // Get Property Value
             if (ObjectUtils.isEmpty(value))
                 value = null;
-            BeanUtils.setProperty(bean, property, value);
-            // PropertyUtilsBean pub = BeanUtilsBean.getInstance().getPropertyUtils();
-            // pub.setSimpleProperty(data, property, value);
+            // Set Property Value
+            if (value!=null)
+            {   // Bean utils will convert if necessary
+                BeanUtils.setProperty(bean, property, value);
+            }
+            else
+            {   // Don't convert, just set
+                PropertyUtils.setProperty(bean, property, null);
+            }
         } catch (IllegalArgumentException e) {
             log.error(bean.getClass().getName() + ": invalid argument for property '" + property
+ "'");
             throw new BeanPropertySetException(bean, property, e);
@@ -383,6 +390,9 @@ public class BeanRecordProxy<T> implemen
         } catch (InvocationTargetException e)
         {   log.error(bean.getClass().getName() + ": unable to set property '" + property
+ "'");
             throw new BeanPropertySetException(bean, property, e);
+        } catch (NoSuchMethodException e) {
+            log.error(bean.getClass().getName() + ": no setter available for property '"
+ property + "'");
+            throw new BeanPropertySetException(bean, property, e);
         }    
     }
     



Mime
View raw message