commit | cbd1b39f584019da9ce26a501eb91cf075ab2902 | [log] [tgz] |
---|---|---|
author | Jon Hall <jhall@ciena.com> | Wed Jan 18 20:15:44 2017 -0800 |
committer | Ray Milkey <ray@onlab.us> | Thu Jan 19 20:24:18 2017 +0000 |
tree | 59a29576180e3242864c1f157e74c82f32487396 | |
parent | 1745e5abbd4cf908579d79af77c3095970095d10 [diff] |
Sonar fixes Rule: Use isEmpty() to check whether the collection is empty or not. Change-Id: Ib5ab56b2263623b297db56c5cac2c2ee80e12725
diff --git a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfControllerImpl.java b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfControllerImpl.java index 83462ee..01f52dc 100644 --- a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfControllerImpl.java +++ b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfControllerImpl.java
@@ -115,10 +115,10 @@ try { List<OspfProcess> ospfProcesses = OspfConfigUtil.processes(processesNode); //if there is interface details then update configuration - if (ospfProcesses.size() > 0 && - ospfProcesses.get(0).areas() != null && ospfProcesses.get(0).areas().size() > 0 && + if (!ospfProcesses.isEmpty() && + ospfProcesses.get(0).areas() != null && !ospfProcesses.get(0).areas().isEmpty() && ospfProcesses.get(0).areas().get(0) != null && - ospfProcesses.get(0).areas().get(0).ospfInterfaceList().size() > 0) { + !ospfProcesses.get(0).areas().get(0).ospfInterfaceList().isEmpty()) { ctrl.updateConfig(ospfProcesses); } } catch (Exception e) {
diff --git a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfMessageDecoder.java b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfMessageDecoder.java index 1d6ae23..e459afa 100644 --- a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfMessageDecoder.java +++ b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfMessageDecoder.java
@@ -66,6 +66,6 @@ ospfMessageList.add(message); } } - return (ospfMessageList.size() > 0) ? ospfMessageList : null; + return (!ospfMessageList.isEmpty()) ? ospfMessageList : null; } } \ No newline at end of file