You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2013/03/24 12:34:34 UTC

svn commit: r1460317 - in /ofbiz/branches/release12.04: ./ framework/entity/src/org/ofbiz/entity/GenericDelegator.java

Author: jacopoc
Date: Sun Mar 24 11:34:33 2013
New Revision: 1460317

URL: http://svn.apache.org/r1460317
Log:
Applied fix from trunk for revision: 1458429 
===

Fixed issue with deserialization from XML of an entity value with null fields

Modified:
    ofbiz/branches/release12.04/   (props changed)
    ofbiz/branches/release12.04/framework/entity/src/org/ofbiz/entity/GenericDelegator.java

Propchange: ofbiz/branches/release12.04/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1458429

Modified: ofbiz/branches/release12.04/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/entity/src/org/ofbiz/entity/GenericDelegator.java?rev=1460317&r1=1460316&r2=1460317&view=diff
==============================================================================
--- ofbiz/branches/release12.04/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (original)
+++ ofbiz/branches/release12.04/framework/entity/src/org/ofbiz/entity/GenericDelegator.java Sun Mar 24 11:34:33 2013
@@ -2358,7 +2358,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);