X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-clustering-commons%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fnode%2Futils%2Fserialization%2FValueType.java;h=9eec8a300a81f2fc304beb7d9978ec7aef26b331;hp=b9e46a3a570fd159d1c8b9284d2efc2ec95c214b;hb=0717c782e9621409f9623f43ba9f6173e4382a44;hpb=df894b365aa4f958a031cf453a028c947d5f7f8d diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueType.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueType.java index b9e46a3a57..9eec8a300a 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueType.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueType.java @@ -8,7 +8,6 @@ package org.opendaylight.controller.cluster.datastore.node.utils.serialization; -import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap.Builder; import java.math.BigDecimal; @@ -91,6 +90,12 @@ public enum ValueType { Object deserialize(final String str) { throw new UnsupportedOperationException("Should have been caught by caller"); } + }, + NULL_TYPE { + @Override + Object deserialize(final String str) { + return null; + } }; private static final Map, ValueType> TYPES; @@ -116,7 +121,9 @@ public enum ValueType { abstract Object deserialize(String str); public static final ValueType getSerializableType(Object node) { - Preconditions.checkNotNull(node, "node should not be null"); + if(node == null){ + return NULL_TYPE; + } final ValueType type = TYPES.get(node.getClass()); if (type != null) {