Fix NPE in Microsemi Driver
Change-Id: I1f9357f589769ce5fb835b95b31379a514116a6a
diff --git a/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/EA1000CfmMepProgrammable.java b/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/EA1000CfmMepProgrammable.java
index 5e38f7c..143ee79 100755
--- a/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/EA1000CfmMepProgrammable.java
+++ b/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/EA1000CfmMepProgrammable.java
@@ -195,13 +195,20 @@
try {
MseaCfm mseacfm =
mseaCfmService.getMepFull(mdName, maName, mepId, session);
- for (org.onosproject.yang.gen.v1.mseacfm.rev20160229.
- mseacfm.mefcfm.MaintenanceDomain replyMd:mseacfm.mefCfm().maintenanceDomain()) {
+ if (mseacfm != null && mseacfm.mefCfm() != null &&
+ mseacfm.mefCfm().maintenanceDomain() != null) {
for (org.onosproject.yang.gen.v1.mseacfm.rev20160229.
- mseacfm.mefcfm.maintenancedomain.
- MaintenanceAssociation replyMa:replyMd.maintenanceAssociation()) {
- for (MaintenanceAssociationEndPoint replyMep:replyMa.maintenanceAssociationEndPoint()) {
- return buildApiMepEntryFromYangMep(replyMep, handler().data().deviceId(), mdName, maName);
+ mseacfm.mefcfm.MaintenanceDomain replyMd :
+ mseacfm.mefCfm().maintenanceDomain()) {
+ for (org.onosproject.yang.gen.v1.mseacfm.rev20160229.
+ mseacfm.mefcfm.maintenancedomain.
+ MaintenanceAssociation replyMa :
+ replyMd.maintenanceAssociation()) {
+ for (MaintenanceAssociationEndPoint replyMep :
+ replyMa.maintenanceAssociationEndPoint()) {
+ return buildApiMepEntryFromYangMep(
+ replyMep, handler().data().deviceId(), mdName, maName);
+ }
}
}
}
@@ -210,7 +217,7 @@
} catch (NetconfException e) {
log.error("Unable to get MEP {}/{}/{} on device {}",
mdName, maName, mepId, handler().data().deviceId());
- throw new CfmConfigException("Unable to create MEP :" + e.getMessage());
+ throw new CfmConfigException("Unable to get MEP :" + e.getMessage());
}
}