Correct Frontend{Client,History}Metadata deserialization
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / persisted / FrontendClientMetadata.java
index 91c81edea4bb2ed67c86464cbaa3fd24f737c963..c9b243052868bb7f0f8cd7c4b9461f05ad6a9ecc 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.controller.cluster.datastore.persisted;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableRangeSet;
 import com.google.common.collect.ImmutableRangeSet.Builder;
@@ -33,7 +34,7 @@ public final class FrontendClientMetadata implements Identifiable<ClientIdentifi
 
     public FrontendClientMetadata(final ClientIdentifier identifier, final RangeSet<UnsignedLong> purgedHistories,
             final Collection<FrontendHistoryMetadata> currentHistories) {
-        this.identifier = Preconditions.checkNotNull(identifier);
+        this.identifier = requireNonNull(identifier);
         this.purgedHistories = ImmutableRangeSet.copyOf(purgedHistories);
         this.currentHistories = ImmutableList.copyOf(currentHistories);
     }
@@ -67,7 +68,7 @@ public final class FrontendClientMetadata implements Identifiable<ClientIdentifi
         }
     }
 
-    public static FrontendClientMetadata readFrom(final DataInput in) throws IOException, ClassNotFoundException {
+    public static FrontendClientMetadata readFrom(final DataInput in) throws IOException {
         final ClientIdentifier id = ClientIdentifier.readFrom(in);
 
         final int purgedSize = in.readInt();
@@ -77,7 +78,7 @@ public final class FrontendClientMetadata implements Identifiable<ClientIdentifi
             final UnsignedLong lower = UnsignedLong.fromLongBits(WritableObjects.readFirstLong(in, header));
             final UnsignedLong upper = UnsignedLong.fromLongBits(WritableObjects.readSecondLong(in, header));
 
-            b.add(Range.closed(lower, upper));
+            b.add(Range.closedOpen(lower, upper));
         }
 
         final int currentSize = in.readInt();
@@ -91,7 +92,7 @@ public final class FrontendClientMetadata implements Identifiable<ClientIdentifi
 
     @Override
     public String toString() {
-        return MoreObjects.toStringHelper(FrontendClientMetadata.class).add("Identifier", identifier)
-                .add("CurrentHistory", currentHistories).add("Range", purgedHistories).toString();
+        return MoreObjects.toStringHelper(FrontendClientMetadata.class).add("identifer", identifier)
+                .add("current", currentHistories).add("purged", purgedHistories).toString();
     }
 }