Add check in cp state to avoid npe 31/74931/1
authorDhruv Bhardwaj <db929a@att.com>
Tue, 7 Aug 2018 19:41:46 +0000 (15:41 -0400)
committerDhruv Bhardwaj <db929a@att.com>
Tue, 7 Aug 2018 19:41:46 +0000 (15:41 -0400)
Change-Id: I27469f5e95e7a20a5110628515ce099e760d1a51

common/src/main/java/org/opendaylight/transportpce/common/openroadminterfaces/OpenRoadmInterfacesImpl.java

index 6eaaec54198ae92ae4f8621119164c29c7ed160f..af8c10e796ce48fb8189e81af9fbd17a04306d45 100644 (file)
@@ -120,7 +120,7 @@ public class OpenRoadmInterfacesImpl implements OpenRoadmInterfaces {
                     otuBuilder =
                     new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.Interface1Builder(
                         intf2Delete.augmentation(
-                        org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.Interface1.class));
+                            org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.Interface1.class));
                 OtuBuilder otu = new OtuBuilder(otuBuilder.getOtu());
                 if (otu.getMaintLoopback() != null) {
                     MaintLoopbackBuilder maintLoopBackBuilder = new MaintLoopbackBuilder();
@@ -200,12 +200,12 @@ public class OpenRoadmInterfacesImpl implements OpenRoadmInterfaces {
         CircuitPacksBuilder cpBldr = new CircuitPacksBuilder(cp);
         boolean change = false;
         if (activate) {
-            if (!cpBldr.getEquipmentState().equals(States.NotReservedInuse)) {
+            if (cpBldr.getEquipmentState()!=null && !cpBldr.getEquipmentState().equals(States.NotReservedInuse)) {
                 cpBldr.setEquipmentState(States.NotReservedInuse);
                 change = true;
             }
         } else {
-            if (!cpBldr.getEquipmentState().equals(States.NotReservedAvailable)) {
+            if ((cpBldr.getEquipmentState()!=null && !cpBldr.getEquipmentState().equals(States.NotReservedAvailable))) {
                 cpBldr.setEquipmentState(States.NotReservedAvailable);
                 change = true;
             }
@@ -239,4 +239,4 @@ public class OpenRoadmInterfacesImpl implements OpenRoadmInterfaces {
         }
     }
 
-}
+}
\ No newline at end of file