Fixed various findbugs issues in PCEP. 60/9360/7
authorDana Kutenicsova <dkutenic@cisco.com>
Sun, 27 Jul 2014 18:28:18 +0000 (20:28 +0200)
committerRobert Varga <rovarga@cisco.com>
Tue, 29 Jul 2014 10:05:17 +0000 (10:05 +0000)
Change-Id: I1d1e2d21009a2ce22b8f8e646e8ba3c62eecc545
Signed-off-by: Dana Kutenicsova <dkutenic@cisco.com>
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/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPDispatcherImpl.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPSessionImpl.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/message/PCEPErrorMessageParser.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/TlvUtil.java
pcep/testtool/src/main/java/org/opendaylight/protocol/pcep/testtool/Main.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/Stateful02TopologySessionListener.java

index 4ea0f233c3eddb7f943e247fd56683ac0eedc8e9..29ea5aa98cbf21fa00a33edb92c97dd7001a2363 100644 (file)
@@ -9,12 +9,9 @@ package org.opendaylight.protocol.pcep.crabbe.initiated00;
 
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Lists;
-
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
-
 import java.util.List;
-
 import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
 import org.opendaylight.protocol.pcep.spi.MessageUtil;
 import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
@@ -48,7 +45,7 @@ public class PcinitiateMessageParser extends AbstractMessageParser {
     public void serializeMessage(final Message message, final ByteBuf out) {
         Preconditions.checkArgument(message instanceof Pcinitiate, "Wrong instance of Message. Passed instance of %s. Need Pcinitiate.", message.getClass());
         final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated._00.rev140113.pcinitiate.message.PcinitiateMessage init = ((Pcinitiate) message).getPcinitiateMessage();
-        ByteBuf buffer = Unpooled.buffer();
+        final ByteBuf buffer = Unpooled.buffer();
         for (final Requests req : init.getRequests()) {
             serializeObject(req.getEndpointsObj(), buffer);
             serializeObject(req.getLspa(), buffer);
@@ -74,13 +71,8 @@ public class PcinitiateMessageParser extends AbstractMessageParser {
         }
         final PcinitiateMessageBuilder builder = new PcinitiateMessageBuilder();
         final List<Requests> reqs = Lists.newArrayList();
-        Requests req = null;
         while (!objects.isEmpty()) {
-            req = this.getValidRequest(objects);
-            if (req == null) {
-                break;
-            }
-            reqs.add(req);
+            reqs.add(this.getValidRequest(objects));
         }
         builder.setRequests(reqs);
         return new PcinitiateBuilder().setPcinitiateMessage(builder.build()).build();
index 41aac5860112ffff9ad7784ffdd6a648882a7e6b..da305895ce8824dddafad3e41b0ebad4bac92758 100644 (file)
@@ -18,7 +18,6 @@ import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev131126.Pcinitiate;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev131126.PcinitiateBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev131126.PcinitiateMessage;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev131126.pcinitiate.message.PcinitiateMessageBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev131126.pcinitiate.message.pcinitiate.message.Requests;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev131126.pcinitiate.message.pcinitiate.message.RequestsBuilder;
@@ -48,9 +47,9 @@ public class CInitiated00PCInitiateMessageParser extends AbstractMessageParser {
 
     @Override
     public void serializeMessage(final Message message, final ByteBuf out) {
-        Preconditions.checkArgument(message instanceof PcinitiateMessage, "Wrong instance of Message. Passed instance of %s. Need PcinitiateMessage.", message.getClass());
+        Preconditions.checkArgument(message instanceof Pcinitiate, "Wrong instance of Message. Passed instance of %s. Need PcinitiateMessage.", message.getClass());
         final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev131126.pcinitiate.message.PcinitiateMessage init = ((Pcinitiate) message).getPcinitiateMessage();
-        ByteBuf buffer = Unpooled.buffer();
+        final ByteBuf buffer = Unpooled.buffer();
         for (final Requests req : init.getRequests()) {
             serializeRequest(req, buffer);
         }
@@ -89,13 +88,8 @@ public class CInitiated00PCInitiateMessageParser extends AbstractMessageParser {
         }
         final PcinitiateMessageBuilder builder = new PcinitiateMessageBuilder();
         final List<Requests> reqs = Lists.newArrayList();
-        Requests req = null;
         while (!objects.isEmpty()) {
-            req = this.getValidRequest(objects);
-            if (req == null) {
-                break;
-            }
-            reqs.add(req);
+            reqs.add(this.getValidRequest(objects));
         }
         builder.setRequests(reqs);
         return new PcinitiateBuilder().setPcinitiateMessage(builder.build()).build();
index 85f99666f35704531f35e4054ece69db40ca4ab2..4dd8c768e13caa3fcb0ee18263b0dd4850cf5eae 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.protocol.pcep.impl;
 
 import com.google.common.base.Preconditions;
-
 import io.netty.bootstrap.Bootstrap;
 import io.netty.bootstrap.ServerBootstrap;
 import io.netty.channel.ChannelFuture;
@@ -16,9 +15,7 @@ import io.netty.channel.ChannelOption;
 import io.netty.channel.EventLoopGroup;
 import io.netty.channel.socket.SocketChannel;
 import io.netty.util.concurrent.Promise;
-
 import java.net.InetSocketAddress;
-
 import org.opendaylight.protocol.framework.AbstractDispatcher;
 import org.opendaylight.protocol.framework.SessionListenerFactory;
 import org.opendaylight.protocol.framework.SessionNegotiatorFactory;
@@ -36,7 +33,7 @@ import org.slf4j.LoggerFactory;
 /**
  * Implementation of PCEPDispatcher.
  */
-public class PCEPDispatcherImpl extends AbstractDispatcher<PCEPSessionImpl, PCEPSessionListener> implements PCEPDispatcher, AutoCloseable {
+public class PCEPDispatcherImpl extends AbstractDispatcher<PCEPSessionImpl, PCEPSessionListener> implements PCEPDispatcher {
     private static final Logger LOG = LoggerFactory.getLogger(PCEPDispatcherImpl.class);
     private final SessionNegotiatorFactory<Message, PCEPSessionImpl, PCEPSessionListener> snf;
     private final MD5ServerChannelFactory<?> scf;
@@ -48,8 +45,8 @@ public class PCEPDispatcherImpl extends AbstractDispatcher<PCEPSessionImpl, PCEP
      * Creates an instance of PCEPDispatcherImpl, gets the default selector and opens it.
      */
     public PCEPDispatcherImpl(final MessageRegistry registry,
-            final SessionNegotiatorFactory<Message, PCEPSessionImpl, PCEPSessionListener> negotiatorFactory,
-            final EventLoopGroup bossGroup, final EventLoopGroup workerGroup) {
+        final SessionNegotiatorFactory<Message, PCEPSessionImpl, PCEPSessionListener> negotiatorFactory,
+        final EventLoopGroup bossGroup, final EventLoopGroup workerGroup) {
         this(registry, negotiatorFactory, bossGroup, workerGroup, null, null);
     }
 
@@ -57,9 +54,9 @@ public class PCEPDispatcherImpl extends AbstractDispatcher<PCEPSessionImpl, PCEP
      * Creates an instance of PCEPDispatcherImpl, gets the default selector and opens it.
      */
     public PCEPDispatcherImpl(final MessageRegistry registry,
-            final SessionNegotiatorFactory<Message, PCEPSessionImpl, PCEPSessionListener> negotiatorFactory,
-            final EventLoopGroup bossGroup, final EventLoopGroup workerGroup, final MD5ChannelFactory<?> cf,
-            final MD5ServerChannelFactory<?> scf) {
+        final SessionNegotiatorFactory<Message, PCEPSessionImpl, PCEPSessionListener> negotiatorFactory,
+        final EventLoopGroup bossGroup, final EventLoopGroup workerGroup, final MD5ChannelFactory<?> cf,
+        final MD5ServerChannelFactory<?> scf) {
         super(bossGroup, workerGroup);
         this.cf = cf;
         this.scf = scf;
@@ -69,7 +66,7 @@ public class PCEPDispatcherImpl extends AbstractDispatcher<PCEPSessionImpl, PCEP
 
     @Override
     public synchronized ChannelFuture createServer(final InetSocketAddress address,
-            final SessionListenerFactory<PCEPSessionListener> listenerFactory) {
+        final SessionListenerFactory<PCEPSessionListener> listenerFactory) {
         return createServer(address, null, listenerFactory);
     }
 
@@ -79,27 +76,27 @@ public class PCEPDispatcherImpl extends AbstractDispatcher<PCEPSessionImpl, PCEP
 
     @Override
     protected void customizeBootstrap(final Bootstrap b) {
-        if (keys != null && !keys.isEmpty()) {
-            if (cf == null) {
+        if (this.keys != null && !this.keys.isEmpty()) {
+            if (this.cf == null) {
                 throw new UnsupportedOperationException("No key access instance available, cannot use key mapping");
             }
 
-            LOG.debug("Adding MD5 keys {} to boostrap {}", keys, b);
-            b.channelFactory(cf);
-            b.option(MD5ChannelOption.TCP_MD5SIG, keys);
+            LOG.debug("Adding MD5 keys {} to boostrap {}", this.keys, b);
+            b.channelFactory(this.cf);
+            b.option(MD5ChannelOption.TCP_MD5SIG, this.keys);
         }
     }
 
     @Override
     protected void customizeBootstrap(final ServerBootstrap b) {
-        if (keys != null && !keys.isEmpty()) {
-            if (scf == null) {
+        if (this.keys != null && !this.keys.isEmpty()) {
+            if (this.scf == null) {
                 throw new UnsupportedOperationException("No key access instance available, cannot use key mapping");
             }
 
-            LOG.debug("Adding MD5 keys {} to boostrap {}", keys, b);
-            b.channelFactory(scf);
-            b.option(MD5ChannelOption.TCP_MD5SIG, keys);
+            LOG.debug("Adding MD5 keys {} to boostrap {}", this.keys, b);
+            b.channelFactory(this.scf);
+            b.option(MD5ChannelOption.TCP_MD5SIG, this.keys);
         }
 
         // Make sure we are doing round-robin processing
@@ -108,9 +105,9 @@ public class PCEPDispatcherImpl extends AbstractDispatcher<PCEPSessionImpl, PCEP
 
     @Override
     public synchronized ChannelFuture createServer(final InetSocketAddress address, final KeyMapping keys,
-            final SessionListenerFactory<PCEPSessionListener> listenerFactory) {
+        final SessionListenerFactory<PCEPSessionListener> listenerFactory) {
         this.keys = keys;
-        ChannelFuture ret = super.createServer(address, new PipelineInitializer<PCEPSessionImpl>() {
+        final ChannelFuture ret = super.createServer(address, new PipelineInitializer<PCEPSessionImpl>() {
             @Override
             public void initializeChannel(final SocketChannel ch, final Promise<PCEPSessionImpl> promise) {
                 ch.pipeline().addLast(PCEPDispatcherImpl.this.hf.getDecoders());
index 9ba2b594b119b44e2c18e3acda46147672501d00..01d9c3b9956de4590eff253c2adefb4588417bb1 100644 (file)
@@ -11,12 +11,10 @@ import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Objects;
 import com.google.common.base.Objects.ToStringHelper;
 import com.google.common.base.Preconditions;
-
 import io.netty.channel.Channel;
 import io.netty.channel.ChannelFuture;
 import io.netty.channel.ChannelFutureListener;
 import io.netty.util.concurrent.Future;
-
 import java.io.IOException;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
@@ -24,7 +22,6 @@ import java.util.Date;
 import java.util.LinkedList;
 import java.util.Queue;
 import java.util.concurrent.TimeUnit;
-
 import org.opendaylight.protocol.framework.AbstractProtocolSession;
 import org.opendaylight.protocol.pcep.PCEPCloseTermination;
 import org.opendaylight.protocol.pcep.PCEPSession;
@@ -93,7 +90,7 @@ public class PCEPSessionImpl extends AbstractProtocolSession<Message> implements
     private final Keepalive kaMessage = new KeepaliveBuilder().setKeepaliveMessage(new KeepaliveMessageBuilder().build()).build();
 
     PCEPSessionImpl(final PCEPSessionListener listener, final int maxUnknownMessages, final Channel channel,
-            final Open localOpen, final Open remoteOpen) {
+        final Open localOpen, final Open remoteOpen) {
         this.listener = Preconditions.checkNotNull(listener);
         this.channel = Preconditions.checkNotNull(channel);
         this.localOpen = Preconditions.checkNotNull(localOpen);
@@ -124,7 +121,7 @@ public class PCEPSessionImpl extends AbstractProtocolSession<Message> implements
         }
 
         LOG.info("Session {}[{}] <-> {}[{}] started", channel.localAddress(), localOpen.getSessionId(), channel.remoteAddress(),
-                remoteOpen.getSessionId());
+            remoteOpen.getSessionId());
     }
 
     /**
@@ -226,7 +223,7 @@ public class PCEPSessionImpl extends AbstractProtocolSession<Message> implements
         LOG.info("Closing PCEP session: {}", this);
         this.closed = true;
         this.sendMessage(new CloseBuilder().setCCloseMessage(
-                new CCloseMessageBuilder().setCClose(new CCloseBuilder().setReason(reason.getShortValue()).build()).build()).build());
+            new CCloseMessageBuilder().setCClose(new CCloseBuilder().setReason(reason.getShortValue()).build()).build()).build());
         this.channel.close();
     }
 
@@ -245,7 +242,7 @@ public class PCEPSessionImpl extends AbstractProtocolSession<Message> implements
         this.listener.onSessionTerminated(this, new PCEPCloseTermination(reason));
         this.closed = true;
         this.sendMessage(new CloseBuilder().setCCloseMessage(
-                new CCloseMessageBuilder().setCClose(new CCloseBuilder().setReason(reason.getShortValue()).build()).build()).build());
+            new CCloseMessageBuilder().setCClose(new CCloseBuilder().setReason(reason.getShortValue()).build()).build()).build());
         this.close();
     }
 
@@ -301,7 +298,7 @@ public class PCEPSessionImpl extends AbstractProtocolSession<Message> implements
      * @param msg incoming message
      */
     @Override
-    public void handleMessage(final Message msg) {
+    public synchronized void handleMessage(final Message msg) {
         // Update last reception time
         this.lastMessageReceivedAt = System.nanoTime();
         this.receivedMsgCount++;
index f62f82bf975227cfad13cb3732f91baf8a0a6a92..76c8270fbddd78a1db5c58fc4411e8dc34f2b205 100644 (file)
@@ -56,7 +56,7 @@ public class PCEPErrorMessageParser extends AbstractMessageParser {
         if (err.getErrors() == null || err.getErrors().isEmpty()) {
             throw new IllegalArgumentException("Errors should not be empty.");
         }
-        ByteBuf buffer = Unpooled.buffer();
+        final ByteBuf buffer = Unpooled.buffer();
         if (err.getErrorType() instanceof RequestCase) {
             final List<Rps> rps = ((RequestCase) err.getErrorType()).getRequest().getRps();
             for (final Rps r : rps) {
@@ -163,7 +163,7 @@ public class PCEPErrorMessageParser extends AbstractMessageParser {
         if (!objects.isEmpty()) {
             throw new PCEPDeserializerException("Unprocessed Objects: " + objects);
         }
-        if (requestParameters != null && !requestParameters.isEmpty()) {
+        if (!requestParameters.isEmpty()) {
             b.setErrorType(new RequestCaseBuilder().setRequest(new RequestBuilder().setRps(requestParameters).build()).build());
         }
 
index 1ce8d40d7b5647eedf364843cfb57f71f4698183..2f4063d0da3037a16cd1f5490360c9a6a4efd5e5 100644 (file)
@@ -11,7 +11,7 @@ import io.netty.buffer.ByteBuf;
 
 public final class TlvUtil {
 
-    protected static final int HEADER_SIZE = 4;
+    public static final int HEADER_SIZE = 4;
 
     public static final int PADDED_TO = 4;
 
index d60f9c9eafd9a1f2fd0135197a49f88b8fda2318..bed72e8d9917ff83edcc53e11a41be984fe357fd 100644 (file)
@@ -25,9 +25,9 @@ public final class Main {
     private static final Logger LOG = LoggerFactory.getLogger(Main.class);
 
     public static final String USAGE = "DESCRIPTION:\n"
-            + "\tCreates a server with given parameters. As long as it runs, it accepts connections " + "from PCCs.\n" + "USAGE:\n"
-            + "\t-a, --address\n" + "\t\tthe ip address to which is this server bound.\n"
-            + "\t\tFormat: x.x.x.x:y where y is port number.\n\n" +
+        + "\tCreates a server with given parameters. As long as it runs, it accepts connections " + "from PCCs.\n" + "USAGE:\n"
+        + "\t-a, --address\n" + "\t\tthe ip address to which is this server bound.\n"
+        + "\t\tFormat: x.x.x.x:y where y is port number.\n\n" +
 
             "\t-d, --deadtimer\n" + "\t\tin seconds, value of the desired deadtimer\n"
             + "\t\tAccording to RFC5440, recommended value for deadtimer is 4 times the value\n"
@@ -82,7 +82,7 @@ public final class Main {
         while (i < args.length) {
             if (args[i].equalsIgnoreCase("-a") || args[i].equalsIgnoreCase("--address")) {
                 final String[] ip = args[i + 1].split(":");
-                address = new InetSocketAddress(InetAddress.getByName(ip[0]), Integer.valueOf(ip[1]));
+                address = new InetSocketAddress(InetAddress.getByName(ip[0]), Integer.parseInt(ip[1]));
                 i++;
             } else if (args[i].equalsIgnoreCase("-d") || args[i].equalsIgnoreCase("--deadtimer")) {
                 deadTimerValue = Integer.valueOf(args[i + 1]);
index 6172af52cd2aefe005121e91c1b2a70fdee87bcf..6e45eb30cc5fa3a89859a7000661dcb2807abf53 100644 (file)
@@ -12,9 +12,7 @@ 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 io.netty.util.concurrent.FutureListener;
-
 import java.net.InetAddress;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -23,9 +21,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.concurrent.ExecutionException;
-
 import javax.annotation.concurrent.GuardedBy;
-
 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -78,11 +74,11 @@ public abstract class AbstractTopologySessionListener<S, L> implements PCEPSessi
         }
 
         void resolveRequest(final PCEPRequest req) {
-            requests.add(req);
+            this.requests.add(req);
         }
 
         private void notifyRequests() {
-            for (PCEPRequest r : requests) {
+            for (final PCEPRequest r : this.requests) {
                 r.done(OperationResults.SUCCESS);
             }
         }
@@ -128,7 +124,7 @@ public abstract class AbstractTopologySessionListener<S, L> implements PCEPSessi
 
         // FIXME: Futures.transform...
         try {
-            Optional<Topology> topoMaybe = trans.read(LogicalDatastoreType.OPERATIONAL, this.serverSessionManager.getTopology()).get();
+            final Optional<Topology> topoMaybe = trans.read(LogicalDatastoreType.OPERATIONAL, this.serverSessionManager.getTopology()).get();
             Preconditions.checkState(topoMaybe.isPresent(), "Failed to find topology.");
             final Topology topo = topoMaybe.get();
             for (final Node n : topo.getNode()) {
@@ -186,7 +182,7 @@ public abstract class AbstractTopologySessionListener<S, L> implements PCEPSessi
         final Node1 ta = new Node1Builder().setPathComputationClient(pccBuilder.build()).build();
 
         this.topologyAugment = this.topologyNode.augmentation(Node1.class);
-        this.pccIdentifier = topologyAugment.child(PathComputationClient.class);
+        this.pccIdentifier = this.topologyAugment.child(PathComputationClient.class);
 
         trans.put(LogicalDatastoreType.OPERATIONAL, this.topologyAugment, ta);
         LOG.trace("Peer data {} set to {}", this.topologyAugment, ta);
@@ -308,7 +304,7 @@ public abstract class AbstractTopologySessionListener<S, L> implements PCEPSessi
     }
 
     protected final synchronized ListenableFuture<OperationResult> sendMessage(final Message message, final S requestId,
-            final Metadata metadata) {
+        final Metadata metadata) {
         final io.netty.util.concurrent.Future<Void> f = this.session.sendMessage(message);
         final PCEPRequest req = new PCEPRequest(metadata);
         this.requests.put(requestId, req);
@@ -318,7 +314,7 @@ public abstract class AbstractTopologySessionListener<S, L> implements PCEPSessi
             public void operationComplete(final io.netty.util.concurrent.Future<Void> future) {
                 if (!future.isSuccess()) {
                     synchronized (AbstractTopologySessionListener.this) {
-                        requests.remove(requestId);
+                        AbstractTopologySessionListener.this.requests.remove(requestId);
                     }
                     req.done(OperationResults.UNSENT);
                     LOG.info("Failed to send request {}, instruction cancelled", requestId, future.cause());
@@ -343,7 +339,7 @@ public abstract class AbstractTopologySessionListener<S, L> implements PCEPSessi
      * @param remove True if this is an LSP path removal
      */
     protected final synchronized void updateLsp(final MessageContext ctx, final L id, final String lspName,
-            final ReportedLspBuilder rlb, final boolean solicited, final boolean remove) {
+        final ReportedLspBuilder rlb, final boolean solicited, final boolean remove) {
 
         final String name;
         if (lspName == null) {
@@ -361,14 +357,14 @@ public abstract class AbstractTopologySessionListener<S, L> implements PCEPSessi
 
         // just one path should be reported
         Preconditions.checkState(rlb.getPath().size() == 1);
-        LspId reportedLspId = rlb.getPath().get(0).getLspId();
+        final LspId reportedLspId = rlb.getPath().get(0).getLspId();
         // check previous report for existing paths
-        ReportedLsp previous = this.lspData.get(name);
+        final ReportedLsp previous = this.lspData.get(name);
         // if no previous report about the lsp exist, just proceed
         if (previous != null) {
-            List<Path> updatedPaths = new ArrayList<>(previous.getPath());
+            final List<Path> updatedPaths = new ArrayList<>(previous.getPath());
             LOG.debug("Found previous paths {} to this lsp name {}", updatedPaths, name);
-            for (Path path : previous.getPath()) {
+            for (final Path path : previous.getPath()) {
                 //we found reported path in previous reports
                 if (path.getLspId().getValue() == 0 || path.getLspId().equals(reportedLspId)) {
                     LOG.debug("Match on lsp-id {}", path.getLspId().getValue() );
@@ -442,7 +438,7 @@ public abstract class AbstractTopologySessionListener<S, L> implements PCEPSessi
     }
 
     protected final InstanceIdentifier<ReportedLsp> lspIdentifier(final String name) {
-        return pccIdentifier.child(ReportedLsp.class, new ReportedLspKey(name));
+        return this.pccIdentifier.child(ReportedLsp.class, new ReportedLspKey(name));
     }
 
     /**
index 4a70ebb59d6e9e8823ffde2084582c4a2b8dcdfd..c46c685463fb66fd760d1e93e6c7580baf90cdab 100644 (file)
@@ -17,8 +17,6 @@ import com.google.common.util.concurrent.ListenableFuture;
 import java.net.InetAddress;
 import java.nio.ByteBuffer;
 import java.util.Collections;
-import javax.annotation.concurrent.GuardedBy;
-
 import org.opendaylight.protocol.pcep.PCEPSession;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated._00.rev140113.PcinitiateBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated._00.rev140113.pcinitiate.message.PcinitiateMessageBuilder;
@@ -71,9 +69,6 @@ public class Stateful02TopologySessionListener extends AbstractTopologySessionLi
         super(serverSessionManager);
     }
 
-    @GuardedBy("this")
-    private long requestId = 1;
-
     @Override
     protected void onSessionUp(final PCEPSession session, final PathComputationClientBuilder pccBuilder) {
         final InetAddress peerAddress = session.getRemoteAddress();
@@ -158,11 +153,6 @@ public class Stateful02TopologySessionListener extends AbstractTopologySessionLi
         return false;
     }
 
-    @GuardedBy("this")
-    private PlspId nextRequest() {
-        return new PlspId(this.requestId++);
-    }
-
     @Override
     public synchronized ListenableFuture<OperationResult> addLsp(final AddLspArgs input) {
         Preconditions.checkArgument(input != null && input.getName() != null && input.getNode() != null && input.getArguments() != null, "Mandatory XML tags are missing.");
@@ -184,17 +174,17 @@ public class Stateful02TopologySessionListener extends AbstractTopologySessionLi
                 final RequestsBuilder rb = new RequestsBuilder();
                 rb.fieldsFrom(input.getArguments());
                 rb.setLspa(new LspaBuilder().setTlvs(
-                        new TlvsBuilder().addAugmentation(
-                                org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated._00.rev140113.Tlvs2.class,
-                                new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated._00.rev140113.Tlvs2Builder().setSymbolicPathName(
-                                        name.build()).build()).build()).build());
+                    new TlvsBuilder().addAugmentation(
+                        org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated._00.rev140113.Tlvs2.class,
+                        new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated._00.rev140113.Tlvs2Builder().setSymbolicPathName(
+                            name.build()).build()).build()).build());
 
                 final PcinitiateMessageBuilder ib = new PcinitiateMessageBuilder(MESSAGE_HEADER);
                 ib.setRequests(Collections.singletonList(rb.build()));
 
                 // Send the message
                 return sendMessage(new PcinitiateBuilder().setPcinitiateMessage(ib.build()).build(), input.getName(),
-                        input.getArguments().getMetadata());
+                    input.getArguments().getMetadata());
             }
         });
     }