BUG-731: do not assign to parameters 16/6716/1
authorRobert Varga <rovarga@cisco.com>
Mon, 5 May 2014 13:22:45 +0000 (15:22 +0200)
committerRobert Varga <rovarga@cisco.com>
Mon, 5 May 2014 13:22:45 +0000 (15:22 +0200)
It is convenient to coerce the argument value, but this approach is a
bit more clean and avoids the sonar warning.

Change-Id: I8648e09c5c02bb082321c3a9a858142eaabdc9ea
Signed-off-by: Robert Varga <rovarga@cisco.com>
pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/AbstractTopologySessionListener.java

index 5342170ea23ac343b18ac3d26ffc959456c6df5b..acc7e2d508f8c9717134ed2cd6b839bf9e86c113 100644 (file)
@@ -308,15 +308,20 @@ public abstract class AbstractTopologySessionListener<SRPID, PLSPID> implements
                return req.getFuture();
        }
 
-       protected final synchronized void updateLsp(final DataModificationTransaction trans, final PLSPID id, String name,
+       protected final synchronized void updateLsp(final DataModificationTransaction trans, final PLSPID id, final String lspName,
                        final ReportedLspBuilder rlb, final boolean solicited) {
-               if (name == null) {
+
+               final String name;
+               if (lspName == null) {
                        name = this.lsps.get(id);
                        if (name == null) {
                                LOG.error("PLSPID {} seen for the first time, not reporting the LSP", id);
                                return;
                        }
+               } else {
+                       name = lspName;
                }
+
                LOG.debug("Saved LSP {} with name {}", id, name);
                this.lsps.put(id, name);