Fix spotbugs issues in network topologies module
[transportpce.git] / networkmodel / src / main / java / org / opendaylight / transportpce / networkmodel / Rdm2XpdrLink.java
index bdf46a6f39b932c9f177ec53aadea60f54bc40cf..d3a26f50fb907305cb0d4f5a1aabb9b19f6b48a5 100644 (file)
@@ -176,20 +176,19 @@ final class Rdm2XpdrLink {
         ReadTransaction readTransaction = dataBroker.newReadOnlyTransaction();
         @NonNull
         FluentFuture<Optional<TerminationPoint>> tpFf = readTransaction.read(LogicalDatastoreType.CONFIGURATION, iiTp);
-        TerminationPoint tp = null;
         if (tpFf.isDone()) {
-            Optional<TerminationPoint> tpOpt = null;
             try {
+                Optional<TerminationPoint> tpOpt;
                 tpOpt = tpFf.get();
+                if (tpOpt.isPresent()) {
+                    return tpOpt.get();
+                }
             } catch (InterruptedException | ExecutionException e) {
                 LOG.error("Impossible to get tp-id {} of node {} from {}", srcTp, srcNode,
-                    NetworkUtils.OVERLAY_NETWORK_ID);
-            }
-            if (tpOpt.isPresent()) {
-                tp = tpOpt.get();
+                    NetworkUtils.OVERLAY_NETWORK_ID, e);
             }
         }
-        return tp;
+        return null;
     }
 
     private Rdm2XpdrLink() {