SONAR suggestions - more blocker bugs
- fixed some cases where pointers could be null
- fixed some booleans statements known to always be
true or false
Change-Id: I0d67c1794b37deeccffda1f4ad0f447857e2a5d1
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/LinkHandler.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/LinkHandler.java
index c530439..ef9fb38 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/LinkHandler.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/LinkHandler.java
@@ -158,18 +158,20 @@
// However we still need to update ECMP hash groups to include new
// buckets
// for the link that has come up.
- if (!seenBefore && isParallelLink(link)) {
- // if link seen first time, we need to ensure hash-groups have
- // all ports
- log.debug("Attempting retryHash for paralled first-time link {}",
- link);
- groupHandler.retryHash(link, false, true);
- } else {
- // seen before-link
- if (isParallelLink(link)) {
- log.debug("Attempting retryHash for paralled seen-before "
- + "link {}", link);
- groupHandler.retryHash(link, false, false);
+ if (groupHandler != null) {
+ if (!seenBefore && isParallelLink(link)) {
+ // if link seen first time, we need to ensure hash-groups have
+ // all ports
+ log.debug("Attempting retryHash for paralled first-time link {}",
+ link);
+ groupHandler.retryHash(link, false, true);
+ } else {
+ // seen before-link
+ if (isParallelLink(link)) {
+ log.debug("Attempting retryHash for paralled seen-before "
+ + "link {}", link);
+ groupHandler.retryHash(link, false, false);
+ }
}
}
}
diff --git a/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/manager/impl/VtnManager.java b/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/manager/impl/VtnManager.java
index fb1bafc..b1e2f94 100644
--- a/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/manager/impl/VtnManager.java
+++ b/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/manager/impl/VtnManager.java
@@ -1121,7 +1121,7 @@
break;
}
}
- if (host != null && vmPort != null && fipPort != null) {
+ if (host != null && fipPort != null) {
DeviceId deviceId = host.location().deviceId();
Port exPort = exPortOfDevice.get(deviceId);
TenantRouter tenantRouter = TenantRouter
@@ -1205,8 +1205,7 @@
.programExternalOut(deviceId, fipNetwork.segmentationId(),
exPort.number(), exPortMac, operation);
} else if (operation == Objective.Operation.REMOVE) {
- if (hostFlag || (!hostFlag
- && routerInfFlagOfTenantRouter.get(tenantRouter) == null)) {
+ if (hostFlag || (routerInfFlagOfTenantRouter.get(tenantRouter) == null)) {
sendNorthSouthL3Flows(deviceId, floatingIp, dstVmGwIp, dstVmGwMac,
l3vni, vmNetwork, vmPort, host, operation);
}