SONAR suggestions - boolean expressions that are known to be 'true' or 'false'
Change-Id: I4e089cb606ecf43444b4d567ad63d622f37506ce
diff --git a/incubator/store/src/main/java/org/onosproject/incubator/store/tunnel/impl/DistributedTunnelStore.java b/incubator/store/src/main/java/org/onosproject/incubator/store/tunnel/impl/DistributedTunnelStore.java
index fd0e95d..82f0140 100644
--- a/incubator/store/src/main/java/org/onosproject/incubator/store/tunnel/impl/DistributedTunnelStore.java
+++ b/incubator/store/src/main/java/org/onosproject/incubator/store/tunnel/impl/DistributedTunnelStore.java
@@ -227,8 +227,7 @@
for (TunnelId id : idSet) {
deletedTunnel = tunnelIdAsKeyStore.get(id);
- if (producerName == null || (producerName != null
- && producerName.equals(deletedTunnel.providerId()))) {
+ if (producerName == null || producerName.equals(deletedTunnel.providerId())) {
tunnelIdAsKeyStore.remove(deletedTunnel.tunnelId());
event = new TunnelEvent(TunnelEvent.Type.TUNNEL_REMOVED,
@@ -256,8 +255,8 @@
for (TunnelId id : idSet) {
deletedTunnel = tunnelIdAsKeyStore.get(id);
- if (type.equals(deletedTunnel.type()) && (producerName == null || (producerName != null
- && producerName.equals(deletedTunnel.providerId())))) {
+ if (type.equals(deletedTunnel.type()) && (producerName == null ||
+ producerName.equals(deletedTunnel.providerId()))) {
tunnelIdAsKeyStore.remove(deletedTunnel.tunnelId());
event = new TunnelEvent(TunnelEvent.Type.TUNNEL_REMOVED,
diff --git a/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/DistributedVirtualNetworkStore.java b/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/DistributedVirtualNetworkStore.java
index 1eaf196..5209543 100644
--- a/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/DistributedVirtualNetworkStore.java
+++ b/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/DistributedVirtualNetworkStore.java
@@ -462,17 +462,15 @@
}
});
- if (hostIdSet != null) {
- networkIdHostIdSetMap.compute(networkId, (id, existingHostIds) -> {
- if (existingHostIds == null || existingHostIds.isEmpty()) {
- return new HashSet<>();
- } else {
- return new HashSet<>(Sets.difference(existingHostIds, hostIdSet));
- }
- });
+ networkIdHostIdSetMap.compute(networkId, (id, existingHostIds) -> {
+ if (existingHostIds == null || existingHostIds.isEmpty()) {
+ return new HashSet<>();
+ } else {
+ return new HashSet<>(Sets.difference(existingHostIds, hostIdSet));
+ }
+ });
- hostIdVirtualHostMap.remove(hostId);
- }
+ hostIdVirtualHostMap.remove(hostId);
}
/**
@@ -567,15 +565,13 @@
Set<VirtualLink> virtualLinkSet = new HashSet<>();
virtualLinkSet.add(virtualLink);
- if (virtualLinkSet != null) {
- networkIdVirtualLinkSetMap.compute(networkId, (id, existingVirtualLinks) -> {
- if (existingVirtualLinks == null || existingVirtualLinks.isEmpty()) {
- return new HashSet<>();
- } else {
- return new HashSet<>(Sets.difference(existingVirtualLinks, virtualLinkSet));
- }
- });
- }
+ networkIdVirtualLinkSetMap.compute(networkId, (id, existingVirtualLinks) -> {
+ if (existingVirtualLinks == null || existingVirtualLinks.isEmpty()) {
+ return new HashSet<>();
+ } else {
+ return new HashSet<>(Sets.difference(existingVirtualLinks, virtualLinkSet));
+ }
+ });
return virtualLink;
}