Bug 7521: Convert DatastoreSnapshot.ShardSnapshot to store Snapshot
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / ShardSnapshotCohort.java
index 0627c0a9e552c1e81bf0e1c5b51177fa03517f0e..93e1d873579f0c02446b666f897cfcae640db525 100644 (file)
@@ -12,7 +12,7 @@ import akka.actor.ActorRef;
 import com.google.common.base.Preconditions;
 import com.google.common.io.ByteSource;
 import java.io.IOException;
-import java.io.InputStream;
+import java.io.ObjectInputStream;
 import java.io.OutputStream;
 import java.util.Optional;
 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
@@ -95,8 +95,8 @@ class ShardSnapshotCohort implements RaftActorSnapshotCohort {
 
     @Override
     public State deserializeSnapshot(ByteSource snapshotBytes) throws IOException {
-        try (final InputStream is = snapshotBytes.openStream()) {
-            return new ShardSnapshotState(ShardDataTreeSnapshot.deserialize(is));
+        try (final ObjectInputStream in = new ObjectInputStream(snapshotBytes.openStream())) {
+            return new ShardSnapshotState(ShardDataTreeSnapshot.deserialize(in));
         }
     }
 }