api: Prevent null pointer on listPublicIpAddress cmd (#4255)

* Prevent null pointer on listPublicIpAddress cmd

Insert an inner join between data_center table and user_ip_address where data_center.removed field is null

* Remove extra join and add a filter for VLAN removed
This commit is contained in:
Rodrigo D. Lopez 2020-08-13 06:06:19 -04:00 committed by GitHub
parent 6704ef2794
commit 3adee270c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1983,6 +1983,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
final SearchBuilder<VlanVO> vlanSearch = _vlanDao.createSearchBuilder();
vlanSearch.and("vlanType", vlanSearch.entity().getVlanType(), SearchCriteria.Op.EQ);
vlanSearch.and("removed", vlanSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
sb.join("vlanSearch", vlanSearch, sb.entity().getVlanId(), vlanSearch.entity().getId(), JoinBuilder.JoinType.INNER);
if (isAllocated != null && isAllocated == true) {