Author: jonesde
Date: Tue Mar 19 17:47:43 2013
New Revision: 1458428

URL: http://svn.apache.org/r1458428
Log:
Fixed issue with deserialization from XML of an entity value with null fields

Modified:
    
ofbiz/branches/release11.04/framework/entity/src/org/ofbiz/entity/GenericDelegator.java

Modified: 
ofbiz/branches/release11.04/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/release11.04/framework/entity/src/org/ofbiz/entity/GenericDelegator.java?rev=1458428&r1=1458427&r2=1458428&view=diff
==============================================================================
--- 
ofbiz/branches/release11.04/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
 (original)
+++ 
ofbiz/branches/release11.04/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
 Tue Mar 19 17:47:43 2013
@@ -2307,7 +2307,13 @@ public class GenericDelegator implements
             String attr = element.getAttribute(name);
 
             if (UtilValidate.isNotEmpty(attr)) {
-                value.setString(name, attr);
+                // GenericEntity.makeXmlElement() sets null values to 
GenericEntity.NULL_FIELD.toString(), so look for
+                //     that and treat it as null
+                if (GenericEntity.NULL_FIELD.toString().equals(attr)) {
+                    value.set(name, null);
+                } else {
+                    value.setString(name, attr);
+                }
             } else {
                 // if no attribute try a subelement
                 Element subElement = UtilXml.firstChildElement(element, name);


Reply via email to