GaOrtiga commented on code in PR #9195: URL: https://github.com/apache/cloudstack/pull/9195#discussion_r1681008587
########## server/src/main/java/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java: ########## @@ -404,7 +425,7 @@ protected boolean doDeleteCustomerGateway(Site2SiteCustomerGateway gw) { protected void doDeleteVpnGateway(Site2SiteVpnGateway gw) { List<Site2SiteVpnConnectionVO> conns = _vpnConnectionDao.listByVpnGatewayId(gw.getId()); - if (conns != null && conns.size() != 0) { + if (CollectionUtils.isEmpty(conns)) { Review Comment: Same here ########## server/src/main/java/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java: ########## @@ -382,19 +407,15 @@ public boolean deleteCustomerGateway(DeleteVpnCustomerGatewayCmd cmd) { Account caller = CallContext.current().getCallingAccount(); Long id = cmd.getId(); - Site2SiteCustomerGateway customerGateway = _customerGatewayDao.findById(id); - if (customerGateway == null) { - throw new InvalidParameterValueException("Fail to find customer gateway with " + id + " !"); - } - _accountMgr.checkAccess(caller, null, false, customerGateway); + Site2SiteCustomerGateway customerGateway = getAndValidateSite2SiteCustomerGateway(id, caller); return doDeleteCustomerGateway(customerGateway); } protected boolean doDeleteCustomerGateway(Site2SiteCustomerGateway gw) { long id = gw.getId(); List<Site2SiteVpnConnectionVO> vpnConnections = _vpnConnectionDao.listByCustomerGatewayId(id); - if (vpnConnections != null && vpnConnections.size() != 0) { + if (CollectionUtils.isEmpty(vpnConnections)) { Review Comment: @DaanHoogland shouldn't this be checking for not empty? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org