Fix code smell in HandshakeManagerImpl 65/94365/4
authorRobert Varga <robert.varga@pantheon.tech>
Sun, 3 Jan 2021 15:21:25 +0000 (16:21 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Sun, 3 Jan 2021 16:22:05 +0000 (17:22 +0100)
Sonar is pointing out thrown Exception which just does not happen,
fix that.

Change-Id: I75c92f9c814d23545b22954f02747b6f211bb01b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/connection/HandshakeManagerImpl.java

index 36fe52daf8aaf5da8ebeed579494e7d31fce3569..758782da5a2c4cb7a76133726154fa84a2382b9b 100644 (file)
@@ -40,10 +40,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class HandshakeManagerImpl implements HandshakeManager {
-
-    private static final long ACTIVE_XID = 20L;
-
     private static final Logger LOG = LoggerFactory.getLogger(HandshakeManagerImpl.class);
+    private static final long ACTIVE_XID = 20L;
 
     private Short lastProposedVersion;
     private Short lastReceivedVersion;
@@ -59,7 +57,8 @@ public class HandshakeManagerImpl implements HandshakeManager {
 
     private final HandshakeListener handshakeListener;
 
-    private boolean useVersionBitmap; // not final just for unit test
+    // not final just for unit test
+    private boolean useVersionBitmap;
 
     private final DeviceConnectionRateLimiter deviceConnectionRateLimiter;
     private final int deviceConnectionHoldTime;
@@ -145,10 +144,9 @@ public class HandshakeManagerImpl implements HandshakeManager {
      * Handles the version negotiation step by step.
      *
      * @param remoteVersion remote version
-     * @throws Exception exception
      */
     @SuppressWarnings("checkstyle:IllegalCatch")
-    private void handleStepByStepVersionNegotiation(final Short remoteVersion) throws Exception {
+    private void handleStepByStepVersionNegotiation(final Short remoteVersion) {
         LOG.debug("remoteVersion:{} lastProposedVersion:{}, highestVersion:{}", remoteVersion, lastProposedVersion,
                   highestVersion);
 
@@ -439,7 +437,7 @@ public class HandshakeManagerImpl implements HandshakeManager {
         LOG.debug("future features [{}] hooked ..", xid);
     }
 
-    public boolean isAllowedToConnect(BigInteger nodeId) {
+    public boolean isAllowedToConnect(final BigInteger nodeId) {
         // The device isn't allowed for connection till device connection hold time is over
         if (deviceConnectionHoldTime > 0) {
             LocalDateTime lastConnectionTime = deviceConnectionStatusProvider.getDeviceLastConnectionTime(nodeId);
@@ -468,9 +466,8 @@ public class HandshakeManagerImpl implements HandshakeManager {
      * This method is not thread safe and can only safely be used from a test.
      */
     @VisibleForTesting
-    @SuppressFBWarnings("IS2_INCONSISTENT_SYNC") // because shake() is synchronized
+    @SuppressFBWarnings(value = "IS2_INCONSISTENT_SYNC", justification = "because shake() is synchronized")
     void setUseVersionBitmap(final boolean useVersionBitmap) {
         this.useVersionBitmap = useVersionBitmap;
     }
-
 }