Login  Register

[jira] [Commented] (OFBIZ-4602) Null values are not synchronized in http mode

Posted by Nicolas Malin (Jira) on Dec 29, 2011; 1:21pm
URL: http://ofbiz.116.s1.nabble.com/jira-Created-OFBIZ-4602-Null-values-are-not-synchronized-in-http-mode-tp4145573p4242709.html


    [ https://issues.apache.org/jira/browse/OFBIZ-4602?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13177159#comment-13177159 ]

Adrian Crum commented on OFBIZ-4602:
------------------------------------

As I mentioned on the dev mailing list, this patch and this "solution" does not make sense. It would be best to understand the problem thoroughly so that a proper solution can be designed.

If I understand correctly, the problem that needs to be solved is this: OFBiz does not serialize field values that are null. That causes a problem with entity sync, because a field's value might have changed from non-null to null. Since null field values are not serialized, the change is not propagated to the entity sync clients.

So, we need a way to serialize null field values. The patch does this by serializing a null value as the String "null". But the patch only does that for field data types that are not String.  Why are String fields excluded?

From my perspective, null field values should be tokenized and the token should be serialized - in ALL fields, not just non-String fields. A good candidate for the token would be GenericEntity.NULL_FIELD.

So, the change to GenericEntity.java line 1079 could look something like this:
{code}

} else {
  element.setAttribute(name, GenericEntity.NULL_FIELD.toString());
}
{code}

Now null field values are serialized in a predictable manner. But that change could adversely impact other modes of entity serialization. Also, entity sync clients will need to be updated to unmarshall the null value tokens.


               

> Null values are not synchronized in http mode
> ---------------------------------------------
>
>                 Key: OFBIZ-4602
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4602
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: Release 4.0, Release 09.04, Release 09.04.01, Release 10.04, SVN trunk
>         Environment: Using entity synchronization over HTTP (not RMI)
>            Reporter: Patrick Antivackis
>            Assignee: Jacques Le Roux
>             Fix For: Release Branch 4.0, Release Branch 09.04, Release Branch 10.04, Release Branch 11.04, SVN trunk
>
>         Attachments: patch-OFBIZ-4602.txt
>
>
> In order to send over http the values to create, store and remove, Ofbiz is Xml serializing the values. GenericValue xml serialization is managed in GenericEntity.makeXmlElement, unfortunately this method just don't serialized null valued fields.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira