Bug 2245 - fixed multiple types of issues 71/14571/2
authorMartin Uhlir <martin.uhlir@pantheon.sk>
Wed, 28 Jan 2015 08:58:55 +0000 (09:58 +0100)
committerMichal Polkorab <michal.polkorab@pantheon.sk>
Mon, 2 Feb 2015 13:27:17 +0000 (13:27 +0000)
Issues solved:
1. Objects should be compared with "equals()"
2. Declarations should use Java collection interfaces such as "List" rather than specific implementation classes such as "LinkedList"
3. Modifiers should be declared in correct order
4. Avoid commented-out lines of code
5. Unused private fields should be removed

Change-Id: I4ca2224a9fd272dd2deb25f6f36db2ed7bd8bb99
Signed-off-by: Martin Uhlir <martin.uhlir@pantheon.sk>
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/UdpChannelInitializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/ChannelOutboundQueue.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/ConnectionAdapterImpl.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/RpcResponseKey.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/statistics/StatisticsCounters.java
util/src/main/java/org/opendaylight/openflowjava/util/ByteBufUtils.java

index 9ff7d65b4dcd073e7d84efd47b789da946680aeb..ba1650e53565d6628957444ace04d5b6e230a572 100644 (file)
@@ -27,6 +27,5 @@ public class UdpChannelInitializer extends ProtocolChannelInitializer<NioDatagra
         OFDatagramPacketEncoder ofDatagramPacketEncoder = new OFDatagramPacketEncoder();
         ofDatagramPacketEncoder.setSerializationFactory(getSerializationFactory());
         ch.pipeline().addLast(PipelineHandlers.OF_ENCODER.name(), ofDatagramPacketEncoder);
-//        connectionFacade.fireConnectionReadyNotification();
     }
 }
\ No newline at end of file
index 65b9c6a6b9384900f94dd5c5d543af8cb775cc10..73812930bc69e9783763613895817d6abe08c86d 100644 (file)
@@ -236,7 +236,7 @@ final class ChannelOutboundQueue extends ChannelInboundHandlerAdapter {
     }
 
     private void conditionalFlush(final ChannelHandlerContext ctx) {
-        Preconditions.checkState(ctx.channel() == channel, "Inconsistent channel %s with context %s", channel, ctx);
+        Preconditions.checkState(ctx.channel().equals(channel), "Inconsistent channel %s with context %s", channel, ctx);
         conditionalFlush();
     }
 
index 7f1c09713517f8d453e2765a50349cc92966ca1c..c2854bec95d35e7bcb5ca718124375ae2b1d08e8 100644 (file)
@@ -95,8 +95,6 @@ public class ConnectionAdapterImpl implements ConnectionFacade {
     private static final Exception QUEUE_FULL_EXCEPTION =
             new RejectedExecutionException("Output queue is full");
 
-    private static final String APPLICATION_TAG = "OPENFLOW_LIBRARY";
-    private static final String TAG = "OPENFLOW";
     private static final RemovalListener<RpcResponseKey, ResponseExpectedRpcListener<?>> REMOVAL_LISTENER =
             new RemovalListener<RpcResponseKey, ResponseExpectedRpcListener<?>>() {
         @Override
index 2463f3f296dda26e5c440bbb6efc1a9dbd50b35d..9cd482b1da5467b616468d09f97f22e30ba9f3cb 100644 (file)
@@ -68,8 +68,6 @@ public class RpcResponseKey {
             }
         } else if (!outputClazz.equals(other.outputClazz)) {
             return false;
-//        if (xid != other.xid)
-//            return false;
         }
         return true;
     }
index 1f4d7ca34b4669c4d9b752271ddb2701ac7a9461..89eeff92a6ae4f765a3de26587f112358e2059bd 100644 (file)
@@ -55,7 +55,7 @@ public final class StatisticsCounters implements StatisticsHandler {
      * Get instance of statistics counters, first created object does not start counting and log reporting
      * @return an instance
      */
-    public synchronized static StatisticsCounters getInstance() {
+    public static synchronized StatisticsCounters getInstance() {
         if (instanceHolder == null) {
             instanceHolder = new StatisticsCounters();
         }
index c4446f28d8ae605897420dcf9131ac13662271ba..269d1735495df4e9b5165fcdcf8ac61c2c93f027 100644 (file)
@@ -74,7 +74,7 @@ public abstract class ByteBufUtils {
         }
         Iterable<String> tmp = Splitter.onPattern(splitPattern)
                 .omitEmptyStrings().split(hexSrc);
-        ArrayList<String> byteChips = Lists.newArrayList(tmp);
+        List<String> byteChips = Lists.newArrayList(tmp);
         byte[] result = new byte[byteChips.size()];
         int i = 0;
         for (String chip : byteChips) {