Update of 
/var/cvs/contributions/CMSContainer/cmsc/utilities/src/java/com/finalist/cmsc/beans
In directory 
james.mmbase.org:/tmp/cvs-serv12139/cmsc/utilities/src/java/com/finalist/cmsc/beans

Modified Files:
        MMBaseNodeMapper.java 
Log Message:
CMSC-1029 fix Enum property throw exception.


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/utilities/src/java/com/finalist/cmsc/beans
See also: http://www.mmbase.org/jira/browse/CMSC-1029


Index: MMBaseNodeMapper.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/utilities/src/java/com/finalist/cmsc/beans/MMBaseNodeMapper.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- MMBaseNodeMapper.java       25 Jul 2008 15:54:04 -0000      1.1
+++ MMBaseNodeMapper.java       29 Jul 2008 10:16:39 -0000      1.2
@@ -2,6 +2,7 @@
 
 import java.lang.reflect.InvocationTargetException;
 import java.util.*;
+import java.beans.PropertyDescriptor;
 
 import org.apache.commons.beanutils.PropertyUtils;
 import org.apache.commons.logging.Log;
@@ -58,6 +59,13 @@
                                           
                                           if (v != null) {
                                           try {
+                        PropertyDescriptor descriptoer = 
PropertyUtils.getPropertyDescriptor(nodeClass, pojoname);
+
+                        if (descriptoer.getPropertyType().isEnum()) {
+                           Enum a = (Enum) 
PropertyUtils.getProperty(nodeClass, pojoname);
+                           v = Enum.valueOf(a.getClass(), (String) v);
+                        }
+
                                                        
PropertyUtils.setProperty(nodeClass, pojoname, v);
                      } catch (IllegalArgumentException e) {
                          log.error("IllegalArgumentException for Node '" + 
node.getNumber()
_______________________________________________
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to