Fixed some major sonar issues 41/26841/8
authorIgor Foltin <igor.foltin@pantheon.sk>
Fri, 11 Sep 2015 13:03:56 +0000 (15:03 +0200)
committerIgor Foltin <igor.foltin@pantheon.sk>
Tue, 22 Sep 2015 11:40:47 +0000 (13:40 +0200)
- mockito-configuration
- websocket-client
- yang-common
- concepts

Change-Id: I5a418919e09ce7e423d31a64759349b9e05be5ad
Signed-off-by: Igor Foltin <igor.foltin@pantheon.sk>
common/concepts/src/main/java/org/opendaylight/yangtools/concepts/CompositeObjectRegistration.java
common/mockito-configuration/src/main/java/org/mockito/configuration/ThrowsUnstubbedMethodException.java
websocket/websocket-client/src/main/java/org/opendaylight/yangtools/websocket/client/WebSocketClientHandler.java
yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/QName.java

index 16daf74007654da65c7bcc07e2ae2b00b39f6a57..265866f5186a3c69a0f819eee1ca2c4586946484 100644 (file)
@@ -50,7 +50,7 @@ public final class CompositeObjectRegistration<T> extends AbstractObjectRegistra
         }
 
         public CompositeObjectRegistrationBuilder<T> add(final ObjectRegistration<? super T> registration) {
-            if (registration.getInstance() != instance) {
+            if (!registration.getInstance().equals(instance)) {
                 throw new IllegalArgumentException("Instance must be same.");
             }
             registrations.add(registration);
@@ -58,7 +58,7 @@ public final class CompositeObjectRegistration<T> extends AbstractObjectRegistra
         }
 
         public CompositeObjectRegistrationBuilder<T> remove(final ObjectRegistration<? super T> registration) {
-            if (registration.getInstance() != instance) {
+            if (!registration.getInstance().equals(instance)) {
                 throw new IllegalArgumentException("Instance must be same.");
             }
             registrations.remove(registration);
index 95b5c2054d41b32242b69676e50447178e414110..d03913058841abb88cfd277ba3d7eff78c9edab1 100644 (file)
@@ -18,7 +18,7 @@ public class ThrowsUnstubbedMethodException implements Answer<Object>, Serializa
     private static final long serialVersionUID = 1L;
 
     @Override
-    public Object answer(final InvocationOnMock invocation) throws UnstubbedMethodException {
+    public Object answer(final InvocationOnMock invocation) {
         throw new UnstubbedMethodException(invocation.toString() + " was not stubbed");
     }
 }
index d2392a4fd394685ed796c6074d87e3bd69a148b9..b4f98eb4da849b9492b1918edee973cb7d39bd47 100644 (file)
@@ -30,7 +30,7 @@ import org.slf4j.LoggerFactory;
  */
 public class WebSocketClientHandler extends SimpleChannelInboundHandler<Object> {
 
-    private static final Logger logger = LoggerFactory
+    private static final Logger LOGGER = LoggerFactory
             .getLogger(WebSocketClientHandler.class.toString());
     private final WebSocketClientHandshaker handshaker;
     private ChannelPromise handshakeFuture;
@@ -72,7 +72,7 @@ public class WebSocketClientHandler extends SimpleChannelInboundHandler<Object>
 
     @Override
     public void channelInactive(ChannelHandlerContext ctx) throws Exception {
-        logger.info("WebSocket Client disconnected!");
+        LOGGER.info("WebSocket Client disconnected!");
     }
 
     @Override
@@ -81,7 +81,7 @@ public class WebSocketClientHandler extends SimpleChannelInboundHandler<Object>
         Channel ch = ctx.channel();
         if (!handshaker.isHandshakeComplete()) {
             handshaker.finishHandshake(ch, (FullHttpResponse) msg);
-            logger.info("WebSocket Client connected!");
+            LOGGER.info("WebSocket Client connected!");
             handshakeFuture.setSuccess();
             return;
         }
@@ -100,12 +100,12 @@ public class WebSocketClientHandler extends SimpleChannelInboundHandler<Object>
 
         if (frame instanceof TextWebSocketFrame) {
             TextWebSocketFrame textFrame = (TextWebSocketFrame) frame;
-            logger.info("WebSocket Client received message: "
+            LOGGER.info("WebSocket Client received message: "
                     + textFrame.text());
         } else if (frame instanceof PongWebSocketFrame) {
-            logger.info("WebSocket Client received pong");
+            LOGGER.info("WebSocket Client received pong");
         } else if (frame instanceof CloseWebSocketFrame) {
-            logger.info("WebSocket Client received closing");
+            LOGGER.info("WebSocket Client received closing");
             ch.close();
         }
     }
index 588579fdb9c03e5911850ccc82287c7f89b0d394..25f6d30b99fb28e96018230ef00915cba7bba21a 100644 (file)
@@ -82,7 +82,7 @@ public final class QName implements Immutable, Serializable, Comparable<QName> {
         final QNameModule cacheMod = QNameModule.cachedReference(myMod);
 
         final QName what;
-        if (cacheMod == myMod) {
+        if (cacheMod.equals(myMod)) {
             what = qname;
         } else {
             what = QName.create(cacheMod, qname.localName);