Sho SHIMIZU
Committed by Gerrit Code Review

Remove branch condition which is always true

Change-Id: I27385061986f7b43f78365278fa763c70a451b46
...@@ -191,22 +191,20 @@ public class VirtualPortManager implements VirtualPortService { ...@@ -191,22 +191,20 @@ public class VirtualPortManager implements VirtualPortService {
191 @Override 191 @Override
192 public boolean updatePorts(Iterable<VirtualPort> vPorts) { 192 public boolean updatePorts(Iterable<VirtualPort> vPorts) {
193 checkNotNull(vPorts, VIRTUALPORT_NOT_NULL); 193 checkNotNull(vPorts, VIRTUALPORT_NOT_NULL);
194 - if (vPorts != null) { 194 + for (VirtualPort vPort : vPorts) {
195 - for (VirtualPort vPort : vPorts) { 195 + vPortStore.put(vPort.portId(), vPort);
196 - vPortStore.put(vPort.portId(), vPort); 196 + if (!vPortStore.containsKey(vPort.portId())) {
197 - if (!vPortStore.containsKey(vPort.portId())) { 197 + log.debug("The virtualPort is not exist whose identifier is {}",
198 - log.debug("The virtualPort is not exist whose identifier is {}", 198 + vPort.portId().toString());
199 - vPort.portId().toString()); 199 + return false;
200 - return false; 200 + }
201 - }
202 201
203 - vPortStore.put(vPort.portId(), vPort); 202 + vPortStore.put(vPort.portId(), vPort);
204 203
205 - if (!vPort.equals(vPortStore.get(vPort.portId()))) { 204 + if (!vPort.equals(vPortStore.get(vPort.portId()))) {
206 - log.debug("The virtualPort is updated failed whose identifier is {}", 205 + log.debug("The virtualPort is updated failed whose identifier is {}",
207 - vPort.portId().toString()); 206 + vPort.portId().toString());
208 - return false; 207 + return false;
209 - }
210 } 208 }
211 } 209 }
212 return true; 210 return true;
...@@ -215,14 +213,12 @@ public class VirtualPortManager implements VirtualPortService { ...@@ -215,14 +213,12 @@ public class VirtualPortManager implements VirtualPortService {
215 @Override 213 @Override
216 public boolean removePorts(Iterable<VirtualPortId> vPortIds) { 214 public boolean removePorts(Iterable<VirtualPortId> vPortIds) {
217 checkNotNull(vPortIds, VIRTUALPORT_ID_NULL); 215 checkNotNull(vPortIds, VIRTUALPORT_ID_NULL);
218 - if (vPortIds != null) { 216 + for (VirtualPortId vPortId : vPortIds) {
219 - for (VirtualPortId vPortId : vPortIds) { 217 + vPortStore.remove(vPortId);
220 - vPortStore.remove(vPortId); 218 + if (vPortStore.containsKey(vPortId)) {
221 - if (vPortStore.containsKey(vPortId)) { 219 + log.debug("The virtualPort is removed failed whose identifier is {}",
222 - log.debug("The virtualPort is removed failed whose identifier is {}", 220 + vPortId.toString());
223 - vPortId.toString()); 221 + return false;
224 - return false;
225 - }
226 } 222 }
227 } 223 }
228 return true; 224 return true;
......