Switch statements should end with a default case. 02/13202/1
authorDana Kutenicsova <dkutenic@cisco.com>
Fri, 28 Nov 2014 13:44:49 +0000 (14:44 +0100)
committerDana Kutenicsova <dkutenic@cisco.com>
Fri, 28 Nov 2014 13:44:49 +0000 (14:44 +0100)
Change-Id: I04b67c4c8a0109a00867970a122a30bc26228b90
Signed-off-by: Dana Kutenicsova <dkutenic@cisco.com>
20 files changed:
bgp/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/LinkstateAdjRIBsIn.java
bgp/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/LinkstateAttributeParser.java
bgp/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/LinkstateNlriParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/OriginAttributeParser.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/AbstractBGPSessionNegotiator.java
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/bgp/topology/provider/LinkstateTopologyBuilder.java
pcep/ietf-stateful02/src/main/java/org/opendaylight/protocol/pcep/crabbe/initiated00/PcinitiateMessageParser.java
pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/ietf/initiated00/CInitiated00PCInitiateMessageParser.java
pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful07/Stateful07PCReportMessageParser.java
pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful07/Stateful07PCUpdateRequestMessageParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/AbstractPCEPSessionNegotiator.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/message/PCEPNotificationMessageParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/message/PCEPReplyMessageParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/message/PCEPRequestMessageParser.java
pcep/segment-routing/src/main/java/org/opendaylight/protocol/pcep/segment/routing02/SrEroSubobjectParser.java
pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/AbstractTopologySessionListener.java
pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/Stateful07TopologySessionListener.java
pcep/topology-spi/src/main/java/org/opendaylight/bgpcep/pcep/topology/spi/AbstractInstructionExecutor.java
programming/impl/src/main/java/org/opendaylight/bgpcep/programming/impl/InstructionImpl.java
programming/impl/src/main/java/org/opendaylight/bgpcep/programming/impl/ProgrammingServiceImpl.java

index d79561b57ff8a5a1e2debcc6c840f5505adf4853..a1456d73abdc716c9306cd1fbcef265154c870ce 100644 (file)
@@ -113,7 +113,7 @@ final class LinkstateAdjRIBsIn extends AbstractAdjRIBs<CLinkstateDestination, Li
 
     LinkstateAdjRIBsIn(final KeyedInstanceIdentifier<Tables, TablesKey> basePath) {
         super(basePath);
-        routesBasePath = basePath.builder().child((Class)LinkstateRoutes.class).build();
+        this.routesBasePath = basePath.builder().child((Class)LinkstateRoutes.class).build();
     }
 
     @Override
@@ -129,7 +129,7 @@ final class LinkstateAdjRIBsIn extends AbstractAdjRIBs<CLinkstateDestination, Li
     public KeyedInstanceIdentifier<LinkstateRoute, LinkstateRouteKey> identifierForKey(final CLinkstateDestination key) {
         final ByteBuf keyBuf = Unpooled.buffer();
         LinkstateNlriParser.serializeNlri(key, keyBuf);
-        return routesBasePath.child(LinkstateRoute.class,
+        return this.routesBasePath.child(LinkstateRoute.class,
             new LinkstateRouteKey(ByteArray.readAllBytes(keyBuf)));
     }
 
@@ -217,6 +217,8 @@ final class LinkstateAdjRIBsIn extends AbstractAdjRIBs<CLinkstateDestination, Li
                     }
                 };
                 break;
+            default:
+                break;
             }
             super.add(trans, peer, key, data);
         }
index a623f234ea9caf18f4ebab6bea99f7f80403084d..44c40d0de1b0f0a95035fdcb20956798d78773c9 100644 (file)
@@ -120,7 +120,7 @@ public class LinkstateAttributeParser implements AttributeParser, AttributeSeria
     }
 
     public int getType() {
-        return type;
+        return this.type;
     }
 
     private NlriType getNlriType(final PathAttributesBuilder pab) {
@@ -185,8 +185,9 @@ public class LinkstateAttributeParser implements AttributeParser, AttributeSeria
         case Node:
             builder.setLinkStateAttribute(parseNodeAttributes(map));
             return builder.build();
+        default:
+            throw new IllegalStateException("Unhandled NLRI type " + nlri);
         }
-        throw new IllegalStateException("Unhandled NLRI type " + nlri);
     }
 
     /**
index 723d52c479c24335486546c1b94d3d9e5693644a..16b93c2aeeb53dde69fa9c5096f38e011713780e 100644 (file)
@@ -334,6 +334,8 @@ public final class LinkstateNlriParser implements NlriParser, NlriSerializer {
             case Node:
                 // node nlri is already parsed as it contains only the common fields for node and link nlri
                 break;
+            default:
+                break;
             }
             nlri.skipBytes(restLength);
             dests.add(builder.build());
index bd1d33d79199c51f6dfb120bdd8a414294aae6eb..7ceef2dd55fcbb691eb554922717273976dd1edb 100644 (file)
@@ -48,6 +48,8 @@ public final class OriginAttributeParser implements AttributeParser, AttributeSe
         case Incomplete:
             builder.setOrigin(INC);
             return;
+        default:
+            return;
         }
     }
 
index a04c0392c4272bf2d28e3ab2696fdbcb8267f6ac..ba3085462b91549e311ec67573af5dd2a6e95a4a 100644 (file)
@@ -158,6 +158,8 @@ public abstract class AbstractBGPSessionNegotiator extends AbstractSessionNegoti
                 return;
             }
             break;
+        default:
+            break;
         }
 
         // Catch-all for unexpected message
index b7e79cc5e85d1ea8a67b791cb885c4da48ea471a..86dffbe0a7573e1fd332be918588441366be04b6 100644 (file)
@@ -480,6 +480,8 @@ public final class LinkstateTopologyBuilder extends AbstractTopologyBuilder<Link
             ilab.addAugmentation(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.IgpLinkAttributes1.class,
                 ospfLinkAttributes(l.getLinkDescriptors().getMultiTopologyId(), la));
             break;
+        default:
+            break;
         }
 
         final LinkBuilder lb = new LinkBuilder();
@@ -631,6 +633,8 @@ public final class LinkstateTopologyBuilder extends AbstractTopologyBuilder<Link
             inab.addAugmentation(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.IgpNodeAttributes1.class,
                 ospfNodeAttributes(nd, na));
             break;
+        default:
+            break;
         }
     }
 
@@ -697,6 +701,8 @@ public final class LinkstateTopologyBuilder extends AbstractTopologyBuilder<Link
                         new OspfPrefixAttributesBuilder().setForwardingAddress(pa.getOspfForwardingAddress().getIpv4Address()).build()).build());
             }
             break;
+        default:
+            break;
         }
     }
 
index 9a336d984c21d282f2209b38d0b57d34dc6061b6..61d6b0d2c90347600745afc4968a203ca70faa27 100644 (file)
@@ -113,6 +113,8 @@ public class PcinitiateMessageParser extends AbstractMessageParser {
                 break;
             case END:
                 break;
+            default:
+                break;
             }
             if (!state.equals(State.END)) {
                 objects.remove(0);
index 32c600c8d9acf9a129e26c941bbaa48b417b554d..a86ddf6483ede5e5447e065d3b2e31e695ca7378 100644 (file)
@@ -143,6 +143,8 @@ public class CInitiated00PCInitiateMessageParser extends AbstractMessageParser {
                 break;
             case END:
                 break;
+            default:
+                break;
             }
             if (!state.equals(State.END)) {
                 objects.remove(0);
index 1cc60b33113a4d9ac69902d8cd9c1cd304b2f547..5c4a66eea6751c9a0562003a723bf61d808e35d5 100644 (file)
@@ -177,6 +177,8 @@ public class Stateful07PCReportMessageParser extends AbstractMessageParser {
                 break;
             case END:
                 break;
+            default:
+                break;
             }
             if (!state.equals(State.END)) {
                 objects.remove(0);
index c7be31c51e2c5a02c56827a556933397073d0818..3eeb0c4f2ff2117544eca3976869c522674c87c2 100644 (file)
@@ -173,6 +173,8 @@ public class Stateful07PCUpdateRequestMessageParser extends AbstractMessageParse
                 break;
             case END:
                 break;
+            default:
+                break;
             }
             if (!state.equals(State.END)) {
                 objects.remove(0);
index 418ad2ac6c32cd5d0dd12907591b98b06a9759b9..c9629096f1de63b4126afe912122521834d59155 100644 (file)
@@ -151,6 +151,8 @@ public abstract class AbstractPCEPSessionNegotiator extends AbstractSessionNegot
                     negotiationFailed(new TimeoutException("OpenWait timer expired"));
                     AbstractPCEPSessionNegotiator.this.state = State.FINISHED;
                     break;
+                default:
+                    break;
                 }
             }
         }, FAIL_TIMER_VALUE, TimeUnit.SECONDS);
@@ -273,6 +275,8 @@ public abstract class AbstractPCEPSessionNegotiator extends AbstractSessionNegot
                 return;
             }
             break;
+        default:
+            break;
         }
         LOG.warn("Channel {} in state {} received unexpected message {}", this.channel, this.state, msg);
         sendErrorMessage(PCEPErrors.NON_OR_INVALID_OPEN_MSG);
index d90731d448aa11d9947265db59e4f1d885645263..ec5a467a589c51320df8e5ed989962ec12e93cc6 100644 (file)
@@ -122,6 +122,8 @@ public class PCEPNotificationMessageParser extends AbstractMessageParser {
                 break;
             case END:
                 break;
+            default:
+                break;
             }
             if (!state.equals(State.END)) {
                 objects.remove(0);
index e7e5d083a0eabac80c09c8c7dc74bf85bd3d1b26..6ef825c4e448c56c05c39f1144819a6ff64398f6 100644 (file)
@@ -218,6 +218,8 @@ public class PCEPReplyMessageParser extends AbstractMessageParser {
                 break;
             case END:
                 break;
+            default:
+                break;
             }
             if (!state.equals(State.END)) {
                 objects.remove(0);
@@ -273,6 +275,8 @@ public class PCEPReplyMessageParser extends AbstractMessageParser {
                 break;
             case END:
                 break;
+            default:
+                break;
             }
             if (!state.equals(State.END)) {
                 objects.remove(0);
index 3185e976cad762ad7ac778d8597f9f0e7e8e6046..593cc33577d1dcce8ee3f701bca17a5fae8264b0 100644 (file)
@@ -298,6 +298,8 @@ public class PCEPRequestMessageParser extends AbstractMessageParser {
                 break;
             case END:
                 break;
+            default:
+                break;
             }
             if (!state.equals(State.END)) {
                 objects.remove(0);
@@ -381,6 +383,8 @@ public class PCEPRequestMessageParser extends AbstractMessageParser {
                 break;
             case END:
                 break;
+            default:
+                break;
             }
             if (!state.equals(SvecState.END)) {
                 objects.remove(0);
index 632a2ee0382cf1000772c59d8d4d1a64f6be27f3..eeb5b058f58de63ebc9e7a0138cefdc5ca49d0ee 100644 (file)
@@ -56,7 +56,7 @@ public class SrEroSubobjectParser implements EROSubobjectParser, EROSubobjectSer
     private static final int F_FLAG_POSITION = 4;
 
     @Override
-    public void serializeSubobject(Subobject subobject, final ByteBuf buffer) {
+    public void serializeSubobject(final Subobject subobject, final ByteBuf buffer) {
         Preconditions.checkArgument(subobject.getSubobjectType() instanceof SrEroSubobject,
                 "Unknown subobject instance. Passed %s. Needed SrEroSubobject.", subobject.getSubobjectType()
                         .getClass());
@@ -102,13 +102,15 @@ public class SrEroSubobjectParser implements EROSubobjectParser, EROSubobjectSer
                 ByteBufWriteUtil.writeUnsignedInt(unnumbered.getRemoteNodeId(), body);
                 ByteBufWriteUtil.writeUnsignedInt(unnumbered.getRemoteInterfaceId(), body);
                 break;
+            default:
+                break;
             }
         }
         EROSubobjectUtil.formatSubobject(TYPE, subobject.isLoose(), body, buffer);
     }
 
     @Override
-    public Subobject parseSubobject(ByteBuf buffer, boolean loose) throws PCEPDeserializerException {
+    public Subobject parseSubobject(final ByteBuf buffer, final boolean loose) throws PCEPDeserializerException {
         Preconditions.checkArgument(buffer != null && buffer.isReadable(),
                 "Array of bytes is mandatory. Can't be null or empty.");
         if (buffer.readableBytes() <= MINIMAL_LENGTH) {
@@ -120,7 +122,7 @@ public class SrEroSubobjectParser implements EROSubobjectParser, EROSubobjectSer
         final SidType sidType = SidType.forValue(sidTypeByte);
         srEroSubobjectBuilder.setSidType(sidType);
 
-        BitSet bitSet = ByteArray.bytesToBitSet(new byte[] { buffer.readByte() });
+        final BitSet bitSet = ByteArray.bytesToBitSet(new byte[] { buffer.readByte() });
         final boolean f = bitSet.get(F_FLAG_POSITION);
         final boolean s = bitSet.get(S_FLAG_POSITION);
         final boolean c = bitSet.get(C_FLAG_POSITION);
@@ -157,6 +159,8 @@ public class SrEroSubobjectParser implements EROSubobjectParser, EROSubobjectSer
                         .setLocalInterfaceId(buffer.readUnsignedInt()).setRemoteNodeId(buffer.readUnsignedInt())
                         .setRemoteInterfaceId(buffer.readUnsignedInt()).build());
                 break;
+            default:
+                break;
             }
         }
         final SubobjectBuilder subobjectBuilder = new SubobjectBuilder();
index 0b9b9fb4e69184b8ebeea2c84ee5c6f2c87a56b5..301561c0743a5dc34f5f2339a1db9262279fda09 100644 (file)
@@ -202,6 +202,8 @@ public abstract class AbstractTopologySessionListener<S, L> implements PCEPSessi
                 LOG.debug("Request {} was not sent when session went down, cancelling the instruction", e.getKey());
                 r.done(OperationResults.UNSENT);
                 break;
+            default:
+                break;
             }
         }
         this.requests.clear();
index 2689201a7f8d0d93456980ac54fd02289b67ae6a..572da1b77e86d59446e7d9eeb0ecb20f413d588c 100644 (file)
@@ -173,6 +173,8 @@ final class Stateful07TopologySessionListener extends AbstractTopologySessionLis
                         // These are transitive states, so we don't have to do anything, as they will be followed
                         // up...
                         break;
+                    default:
+                        break;
                     }
                     // if remove flag is set in SRP object, remove the tunnel immediately
                     if (srp.getAugmentation(Srp1.class) != null) {
index 7d9192e3d4483469ba9a1be7918216b848c8bde8..a7b55bb56668cbb2c52a644bb400c0cfc7b75e63 100644 (file)
@@ -11,7 +11,6 @@ import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
-
 import org.opendaylight.bgpcep.programming.spi.Instruction;
 import org.opendaylight.bgpcep.programming.spi.InstructionScheduler;
 import org.opendaylight.bgpcep.programming.spi.SchedulerException;
@@ -43,7 +42,7 @@ public abstract class AbstractInstructionExecutor implements FutureCallback<Inst
 
         try {
             s = scheduler.scheduleInstruction(fwd.getInput());
-        } catch (SchedulerException e) {
+        } catch (final SchedulerException e) {
             LOG.info("Instuction {} failed to schedule", e.getMessage(), e);
             return new FailureCaseBuilder().setFailure(e.getFailure()).build();
         }
@@ -70,6 +69,8 @@ public abstract class AbstractInstructionExecutor implements FutureCallback<Inst
                         case Unsent:
                             insn.executionCompleted(InstructionStatus.Cancelled, null);
                             break;
+                        default:
+                            break;
                         }
                     } else {
                         insn.executionCompleted(InstructionStatus.Successful, null);
index acf788936bba9885ede8afb346ff7fc9feff9148..2929c82e72f0b650dd865639bf447358c70dc5c4 100644 (file)
@@ -75,6 +75,8 @@ final class InstructionImpl implements Instruction {
         case Scheduled:
         case Successful:
             break;
+        default:
+            break;
         }
     }
 
@@ -119,6 +121,8 @@ final class InstructionImpl implements Instruction {
             LOG.debug("Instruction {} timed out while Scheduled, cancelling it", this.id);
             cancel(this.heldUpDetails);
             break;
+        default:
+            break;
         }
     }
 
@@ -150,9 +154,9 @@ final class InstructionImpl implements Instruction {
         case Scheduled:
             cancel(details);
             return null;
+        default:
+            throw new IllegalStateException("Unhandled instruction state " + this.status);
         }
-
-        throw new IllegalStateException("Unhandled instruction state " + this.status);
     }
 
     @Override
@@ -235,6 +239,8 @@ final class InstructionImpl implements Instruction {
             case Successful:
                 // No-op
                 break;
+            default:
+                break;
             }
         }
         if (!unmet.isEmpty()) {
index 6ebf815ba9f1cd7ef083a4a475993ce691f61bfe..bbda508a0fe29e6ae62d67ffe6ab9e5f0f52f90e 100644 (file)
@@ -188,6 +188,8 @@ public final class ProgrammingServiceImpl implements AutoCloseable, InstructionS
                 LOG.debug("Instruction {} cannot be cleaned because of it's in state {}", id, i.getStatus());
                 failed.add(id);
                 continue;
+            default:
+                break;
             }
 
             // The instruction is in a terminal state, we need to just unlink
@@ -228,6 +230,8 @@ public final class ProgrammingServiceImpl implements AutoCloseable, InstructionS
             case Scheduled:
             case Successful:
                 break;
+            default:
+                break;
             }
         }
         /*