X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Futils%2FSerializationUtils.java;h=97e3383490d5bb058d3999c454464c435d16ee0c;hb=dea3effede98cfb561c44d66b24c2d71a44b10a3;hp=5f84f54b74f30e173c0b77af72178b6daffdfc9e;hpb=83ea85a47d23d6068750f1a4d20ec8ffe182f32f;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/SerializationUtils.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/SerializationUtils.java index 5f84f54b74..97e3383490 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/SerializationUtils.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/SerializationUtils.java @@ -35,7 +35,7 @@ public final class SerializationUtils { public static final ThreadLocal REUSABLE_WRITER_TL = new ThreadLocal<>(); public static final ThreadLocal REUSABLE_READER_TL = new ThreadLocal<>(); - public static interface Applier { + public interface Applier { void apply(T instance, YangInstanceIdentifier path, NormalizedNode node); } @@ -114,22 +114,19 @@ public final class SerializationUtils { } public static NormalizedNode deserializeNormalizedNode(byte [] bytes) { - NormalizedNode node = null; try { - node = tryDeserializeNormalizedNode(new DataInputStream(new ByteArrayInputStream(bytes))); + return tryDeserializeNormalizedNode(new DataInputStream(new ByteArrayInputStream(bytes))); } catch(InvalidNormalizedNodeStreamException e) { // Probably from legacy protobuf serialization - try that. try { NormalizedNodeMessages.Node serializedNode = NormalizedNodeMessages.Node.parseFrom(bytes); - node = new NormalizedNodeToNodeCodec(null).decode(serializedNode); + return new NormalizedNodeToNodeCodec(null).decode(serializedNode); } catch (InvalidProtocolBufferException e2) { throw new IllegalArgumentException("Error deserializing NormalizedNode", e); } } catch (IOException e) { throw new IllegalArgumentException("Error deserializing NormalizedNode", e); } - - return node; } public static byte [] serializeNormalizedNode(NormalizedNode node) {