Remove duplicate 'return true' statements 96/36296/2
authorRobert Varga <rovarga@cisco.com>
Wed, 16 Mar 2016 13:48:12 +0000 (14:48 +0100)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 21 Mar 2016 11:11:42 +0000 (11:11 +0000)
Instead of having each case return true, make it the default return
from the method and use the last else branch to return false.

Change-Id: I545d2f2c19ef8a10b693a0e904766141bc5db34e
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorSnapshotMessageSupport.java

index 56f40df7584b2bae4fdbcf42ae87a87eda09f527..7750cc89230430c4c9e780b8a9f72dac5a0c19de 100644 (file)
@@ -65,27 +65,23 @@ class RaftActorSnapshotMessageSupport {
     }
 
     boolean handleSnapshotMessage(Object message, ActorRef sender) {
     }
 
     boolean handleSnapshotMessage(Object message, ActorRef sender) {
-        if(message instanceof ApplySnapshot ) {
+        if (message instanceof ApplySnapshot ) {
             onApplySnapshot((ApplySnapshot) message);
             onApplySnapshot((ApplySnapshot) message);
-            return true;
         } else if (message instanceof SaveSnapshotSuccess) {
             onSaveSnapshotSuccess((SaveSnapshotSuccess) message);
         } else if (message instanceof SaveSnapshotSuccess) {
             onSaveSnapshotSuccess((SaveSnapshotSuccess) message);
-            return true;
         } else if (message instanceof SaveSnapshotFailure) {
             onSaveSnapshotFailure((SaveSnapshotFailure) message);
         } else if (message instanceof SaveSnapshotFailure) {
             onSaveSnapshotFailure((SaveSnapshotFailure) message);
-            return true;
         } else if (message instanceof CaptureSnapshotReply) {
             onCaptureSnapshotReply(((CaptureSnapshotReply) message).getSnapshot());
         } else if (message instanceof CaptureSnapshotReply) {
             onCaptureSnapshotReply(((CaptureSnapshotReply) message).getSnapshot());
-            return true;
         } else if (message.equals(COMMIT_SNAPSHOT)) {
             context.getSnapshotManager().commit(-1, currentBehavior);
         } else if (message.equals(COMMIT_SNAPSHOT)) {
             context.getSnapshotManager().commit(-1, currentBehavior);
-            return true;
         } else if (message instanceof GetSnapshot) {
             onGetSnapshot(sender);
         } else if (message instanceof GetSnapshot) {
             onGetSnapshot(sender);
-            return true;
         } else {
             return false;
         }
         } else {
             return false;
         }
+
+        return true;
     }
 
     private void onCaptureSnapshotReply(byte[] snapshotBytes) {
     }
 
     private void onCaptureSnapshotReply(byte[] snapshotBytes) {