Fixed JSON Deserializer to retain empty objects as empty rather than NULL. 37/3437/1
authorMadhu Venugopal <mavenugo@gmail.com>
Wed, 4 Dec 2013 00:41:21 +0000 (16:41 -0800)
committerMadhu Venugopal <mavenugo@gmail.com>
Wed, 4 Dec 2013 00:41:21 +0000 (16:41 -0800)
During Update operations, ovsdb-server sends NULL values for the columns that are not changed.
If there is a change from an empty map to valid value, then that change goes undetected.
Hence we need to retain the emptiness of the map and array intact in order to differentiate the
behaviour.

Change-Id: I9ff356c0f390aeaf0cb5d43bd2ba756206f3e345
Signed-off-by: Madhu Venugopal <mavenugo@gmail.com>
ovsdb/src/main/java/org/opendaylight/ovsdb/lib/notation/json/Converter.java

index 7098f72275a505da4617fe16ce75dd08fbb7b00d..507601dbf2283f2b11f583c8e490b045d9d438e4 100644 (file)
@@ -1,16 +1,16 @@
 package org.opendaylight.ovsdb.lib.notation.json;
 
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.util.StdConverter;
-
 import org.opendaylight.ovsdb.lib.message.TableUpdates;
 import org.opendaylight.ovsdb.lib.message.UpdateNotification;
 import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
 import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.util.StdConverter;
+
 public class Converter {
 
     static AtomDeser atomDeser = new AtomDeser();
@@ -52,7 +52,7 @@ public class Converter {
                                 map.put(key, value);
                             }
                         }
-                        return map.isEmpty() ? null : map;
+                        return map;
                     } else if (node.size() == 0) {
                         return null;
                     }