X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2Fmessages%2FInstallSnapshot.java;fp=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2Fmessages%2FInstallSnapshot.java;h=3cd470f6cc6d3c7186dc4fb20324482b216153d7;hp=4d78aa7a860cac352bea46d468f005cbf5b1a0a7;hb=8e1d3c4f9001fbc8a5d3d3bea57916c5099078b2;hpb=55ac0d700c4b20f145924b169b938321dc10a476 diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/InstallSnapshot.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/InstallSnapshot.java index 4d78aa7a86..3cd470f6cc 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/InstallSnapshot.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/InstallSnapshot.java @@ -37,9 +37,10 @@ public final class InstallSnapshot extends AbstractRaftRPC { private final Optional serverConfig; private final short recipientRaftVersion; - @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "Stores a reference to an externally mutable byte[] " - + "object but this is OK since this class is merely a DTO and does not process byte[] internally. " - + "Also it would be inefficient to create a copy as the byte[] could be large.") + @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = """ + Stores a reference to an externally mutable byte[] object but this is OK since this class is merely a DTO and \ + does not process byte[] internally. Also it would be inefficient to create a copy as the byte[] could be \ + large.""") public InstallSnapshot(final long term, final String leaderId, final long lastIncludedIndex, final long lastIncludedTerm, final byte[] data, final int chunkIndex, final int totalChunks, final OptionalInt lastChunkHashCode, final Optional serverConfig, @@ -76,9 +77,10 @@ public final class InstallSnapshot extends AbstractRaftRPC { return lastIncludedTerm; } - @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "Exposes a mutable object stored in a field but " - + "this is OK since this class is merely a DTO and does not process the byte[] internally. " - + "Also it would be inefficient to create a return copy as the byte[] could be large.") + @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = """ + Exposes a mutable object stored in a field but this is OK since this class is merely a DTO and does not \ + process the byte[] internally. Also it would be inefficient to create a return copy as the byte[] could be \ + large.""") public byte[] getData() { return data; } @@ -139,12 +141,12 @@ public final class InstallSnapshot extends AbstractRaftRPC { out.writeByte(installSnapshot.lastChunkHashCode.isPresent() ? 1 : 0); if (installSnapshot.lastChunkHashCode.isPresent()) { - out.writeInt(installSnapshot.lastChunkHashCode.getAsInt()); + out.writeInt(installSnapshot.lastChunkHashCode.orElseThrow()); } out.writeByte(installSnapshot.serverConfig.isPresent() ? 1 : 0); if (installSnapshot.serverConfig.isPresent()) { - out.writeObject(installSnapshot.serverConfig.get()); + out.writeObject(installSnapshot.serverConfig.orElseThrow()); } out.writeObject(installSnapshot.data);