Protect renderer vs cp.getPorts() == null 56/62456/3
authorCédric Ollivier <cedric.ollivier@orange.com>
Wed, 30 Aug 2017 16:03:01 +0000 (18:03 +0200)
committerCédric Ollivier <cedric.ollivier@orange.com>
Fri, 1 Sep 2017 07:33:11 +0000 (09:33 +0200)
Otherwise it raises NullPointerException later in the process.

Change-Id: Icc662493b3239cecf790400f25b5970a570e9f8b
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
renderer/src/main/java/org/opendaylight/transportpce/renderer/mapping/PortMapping.java

index 1cd38e87da19531275c1f7cc8785d393ba88025f..560a0048906e1aa06a50824c3d366e80db9b9a65 100644 (file)
@@ -237,7 +237,9 @@ public class PortMapping {
 
                 if (circuitPackObject.isPresent()) {
                     CircuitPacks cp = circuitPackObject.get();
-                    if (!cp.getPorts().isEmpty()) {
+                    if (cp.getPorts() == null) {
+                        LOG.warn("No port found for {} {}: {}", deviceInfo.getNodeId(), circuitPackName, cp);
+                    } else if (!cp.getPorts().isEmpty()) {
                         for (Ports port : cp.getPorts()) {
 
                             if (port.getLogicalConnectionPoint() != null && port.getPortQual().getIntValue() == 2) {