Remove unused exceptions
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / persisted / CommitTransactionPayload.java
index dd27b4e629d2b593bc37e717ad52446e6b769eb2..213d61b8dda72ad24b6eb3577d43dad0d0d859ab 100644 (file)
@@ -19,7 +19,6 @@ import java.io.ObjectOutput;
 import java.io.Serializable;
 import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.Map.Entry;
-import java.util.Optional;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
@@ -31,11 +30,14 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
  * @author Robert Varga
  */
 @Beta
-public final class CommitTransactionPayload extends Payload implements DataTreeCandidateSupplier, Serializable {
+public final class CommitTransactionPayload extends Payload implements Serializable {
     private static final class Proxy implements Externalizable {
         private static final long serialVersionUID = 1L;
         private byte[] serialized;
 
+        // checkstyle flags the public modifier as redundant which really doesn't make sense since it clearly isn't
+        // redundant. It is explicitly needed for Java serialization to be able to create instances via reflection.
+        @SuppressWarnings("checkstyle:RedundantModifier")
         public Proxy() {
             // For Externalizable
         }
@@ -51,7 +53,7 @@ public final class CommitTransactionPayload extends Payload implements DataTreeC
         }
 
         @Override
-        public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
+        public void readExternal(final ObjectInput in) throws IOException {
             final int length = in.readInt();
             serialized = new byte[length];
             in.readFully(serialized);
@@ -78,10 +80,9 @@ public final class CommitTransactionPayload extends Payload implements DataTreeC
         return new CommitTransactionPayload(out.toByteArray());
     }
 
-    @Override
-    public Entry<Optional<TransactionIdentifier>, DataTreeCandidate> getCandidate() throws IOException {
+    public Entry<TransactionIdentifier, DataTreeCandidate> getCandidate() throws IOException {
         final DataInput in = ByteStreams.newDataInput(serialized);
-        return new SimpleImmutableEntry<>(Optional.of(TransactionIdentifier.readFrom(in)),
+        return new SimpleImmutableEntry<>(TransactionIdentifier.readFrom(in),
                 DataTreeCandidateInputOutput.readDataTreeCandidate(in));
     }