From 1c6adf2f0ae63e00f7b8b2a4224f818938341ece Mon Sep 17 00:00:00 2001 From: "David E. Jones" Date: Tue, 19 Mar 2013 17:48:28 +0000 Subject: [PATCH] Fixed issue with deserialization from XML of an entity value with null fields git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1458429 13f79535-47bb-0310-9956-ffa450edef68 --- .../entity/src/org/ofbiz/entity/GenericDelegator.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/framework/entity/src/org/ofbiz/entity/GenericDelegator.java b/framework/entity/src/org/ofbiz/entity/GenericDelegator.java index 9d5de8cab1..c5a8dfbc04 100644 --- a/framework/entity/src/org/ofbiz/entity/GenericDelegator.java +++ b/framework/entity/src/org/ofbiz/entity/GenericDelegator.java @@ -2377,7 +2377,13 @@ public class GenericDelegator implements Delegator { 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);