[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16453986#comment-16453986 ] ASF subversion and git services commented on CLOUDSTACK-10356: -- Commit 4c42aafae0d3286a38d796a7c69a6aec6810cf79 in cloudstack's branch refs/heads/master from brett [ https://gitbox.apache.org/repos/asf?p=cloudstack.git;h=4c42aaf ] [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector (#2573) * fix https://issues.apache.org/jira/browse/CLOUDSTACK-10356 * del patch file * Update ResourceCountDaoImpl.java * fix some format * fix code * fix error message in VolumeOrchestrator * add check null stmt * del import unuse class * use BooleanUtils to check Boolean * fix error message * delete unuse function * delete the deprecated function updateDomainCount * add error log and throw exception in ProjectManagerImpl.java > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16453983#comment-16453983 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - rafaelweingartner closed pull request #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java index f02fdc495f9..c8279ff3f99 100644 --- a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java +++ b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java @@ -499,6 +499,9 @@ public VolumeInfo copyVolumeFromSecToPrimary(VolumeInfo volume, VirtualMachine v // Find a suitable storage to create volume on StoragePool destPool = findStoragePool(dskCh, dc, pod, clusterId, null, vm, avoidPools); +if (destPool == null) { +throw new CloudRuntimeException("Failed to find a suitable storage pool to create Volume in the pod/cluster of the provided VM "+ vm.getUuid()); +} DataStore destStore = dataStoreMgr.getDataStore(destPool.getId(), DataStoreRole.Primary); AsyncCallFuture future = volService.copyVolume(volume, destStore); diff --git a/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDao.java b/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDao.java index b5a75d196fa..28f2a536071 100644 --- a/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDao.java +++ b/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDao.java @@ -39,9 +39,6 @@ */ void setResourceCount(long ownerId, ResourceOwnerType ownerType, ResourceType type, long count); -@Deprecated -void updateDomainCount(long domainId, ResourceType type, boolean increment, long delta); - boolean updateById(long id, boolean increment, long delta); void createResourceCounts(long ownerId, ResourceOwnerType ownerType); diff --git a/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDaoImpl.java b/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDaoImpl.java index 56261337faf..dbf2228183b 100644 --- a/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDaoImpl.java @@ -120,16 +120,6 @@ public void setResourceCount(long ownerId, ResourceOwnerType ownerType, Resource } } -@Override -@Deprecated -public void updateDomainCount(long domainId, ResourceType type, boolean increment, long delta) { -delta = increment ? delta : delta * -1; - -ResourceCountVO resourceCountVO = findByOwnerAndType(domainId, ResourceOwnerType.Domain, type); -resourceCountVO.setCount(resourceCountVO.getCount() + delta); -update(resourceCountVO.getId(), resourceCountVO); -} - @Override public boolean updateById(long id, boolean increment, long delta) { delta = increment ? delta : delta * -1; diff --git a/plugins/deployment-planners/implicit-dedication/src/main/java/com/cloud/deploy/ImplicitDedicationPlanner.java b/plugins/deployment-planners/implicit-dedication/src/main/java/com/cloud/deploy/ImplicitDedicationPlanner.java index 5bad9226eed..45f16abd2af 100644 --- a/plugins/deployment-planners/implicit-dedication/src/main/java/com/cloud/deploy/ImplicitDedicationPlanner.java +++ b/plugins/deployment-planners/implicit-dedication/src/main/java/com/cloud/deploy/ImplicitDedicationPlanner.java @@ -39,6 +39,7 @@ import com.cloud.utils.NumbersUtil; import com.cloud.vm.VMInstanceVO; import com.cloud.vm.VirtualMachineProfile; +import org.springframework.util.CollectionUtils; public class ImplicitDedicationPlanner extends FirstFitPlanner implements DeploymentClusterPlanner { @@ -256,14 +257,15 @@ public PlannerResourceUsage getResourceUsage(VirtualMachineProfile vmProfile, De // Get the list of all the hosts in the given clusters List allHosts = new ArrayList(); -for (Long cluster : clusterList) { -List hostsInCluster = resourceMgr.listAllHostsInCluster(cluster); -for (HostVO hostVO : hostsInCluster) { +if (!CollectionUtils.isEmpty(clusterList)) { +for (Long cluster : clusterList) { +
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16453985#comment-16453985 ] ASF subversion and git services commented on CLOUDSTACK-10356: -- Commit 4c42aafae0d3286a38d796a7c69a6aec6810cf79 in cloudstack's branch refs/heads/master from brett [ https://gitbox.apache.org/repos/asf?p=cloudstack.git;h=4c42aaf ] [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector (#2573) * fix https://issues.apache.org/jira/browse/CLOUDSTACK-10356 * del patch file * Update ResourceCountDaoImpl.java * fix some format * fix code * fix error message in VolumeOrchestrator * add check null stmt * del import unuse class * use BooleanUtils to check Boolean * fix error message * delete unuse function * delete the deprecated function updateDomainCount * add error log and throw exception in ProjectManagerImpl.java > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16449873#comment-16449873 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - blueorangutan commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-383935669 Packaging result: ✔centos6 ✔centos7 ✔debian. JID-1968 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16449811#comment-16449811 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - blueorangutan commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-383922721 @rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16449810#comment-16449810 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - rhtyd commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-383922582 @blueorangutan package This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16449198#comment-16449198 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - brettKK commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-383784452 @rafaelweingartner @lujiefsi I locate all exception location from the logs: CloudStackPrimaryDataStoreLifeCycleImpl#319 UserVmManagerImpl#5044 DeployVMCmd#567 ResourceManagerImpl#1278 AssertionError: Check uptime is less than 3 mins or not AssertionError: Check for warnings in tests these exception and their code are really not related to our code. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16448076#comment-16448076 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - rafaelweingartner commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-383561132 That is a good thing. Sometimes this happens. The errors may be due to problems in the test bed. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16448075#comment-16448075 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - rafaelweingartner commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-383561132 that is a good thing. Sometimes this happens. The errors may be due to environmental problems in the test bed. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16448070#comment-16448070 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - lujiefsi commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-383560832 @rafaelweingartner I extract the exception from the log, and check the code around them, those exception seems not caused by this patch. @brettKK could you please check again. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16447951#comment-16447951 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - rafaelweingartner commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-383535578 @lujiefsi no, they do not seem to be. However, to be safe, can @brettKK download the log files and check the errors/failures there? Just to make sure that the errors are not related to the changes introduced here. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16447076#comment-16447076 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - lujiefsi commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-383351323 Are the errors caused by the patch? or can the patch be merged? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16446244#comment-16446244 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - blueorangutan commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-383197474 Trillian test result (tid-2528) Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7 Total time taken: 85758 seconds Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr2573-t2528-kvm-centos7.zip Intermitten failure detected: /marvin/tests/smoke/test_certauthority_root.py Intermitten failure detected: /marvin/tests/smoke/test_primary_storage.py Intermitten failure detected: /marvin/tests/smoke/test_routers.py Intermitten failure detected: /marvin/tests/smoke/test_snapshots.py Intermitten failure detected: /marvin/tests/smoke/test_ssvm.py Intermitten failure detected: /marvin/tests/smoke/test_vm_life_cycle.py Intermitten failure detected: /marvin/tests/smoke/test_host_maintenance.py Intermitten failure detected: /marvin/tests/smoke/test_hostha_kvm.py Smoke tests completed. 60 look OK, 7 have error(s) Only failed tests results shown below: Test | Result | Time (s) | Test File --- | --- | --- | --- test_01_add_primary_storage_disabled_host | `Error` | 0.64 | test_primary_storage.py test_01_primary_storage_nfs | `Error` | 0.12 | test_primary_storage.py ContextSuite context=TestStorageTags>:setup | `Error` | 0.22 | test_primary_storage.py test_04_restart_network_wo_cleanup | `Failure` | 2.92 | test_routers.py test_02_list_snapshots_with_removed_data_store | `Error` | 1.16 | test_snapshots.py test_05_stop_ssvm | `Failure` | 57.98 | test_ssvm.py test_08_migrate_vm | `Error` | 13.82 | test_vm_life_cycle.py test_01_cancel_host_maintenace_with_no_migration_jobs | `Failure` | 0.12 | test_host_maintenance.py test_02_cancel_host_maintenace_with_migration_jobs | `Error` | 2.33 | test_host_maintenance.py test_hostha_enable_ha_when_host_in_maintenance | `Error` | 4.60 | test_hostha_kvm.py This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16444640#comment-16444640 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - blueorangutan commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-382847137 @rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16444638#comment-16444638 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - rhtyd commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-382847005 Tests LGTM, most changes are null checks. I'll kick test. @blueorangutan test This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16443874#comment-16443874 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - rafaelweingartner commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-382693277 It is the contributor choice the branch he/she is sending the contributions. If you already did everything in master, there is no reason to use even more time to port to 4.11. Unless you need these changes in 4.11. Moreover, for us to be able to execute the merge, we need reviewers to approve and integration tests to pass. As soon as we have the test results, and if they are positive, we can proceed and merge this PR. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16443871#comment-16443871 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - blueorangutan commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-382692337 Packaging result: ✔centos6 ✔centos7 ✔debian. JID-1948 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16443841#comment-16443841 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - blueorangutan commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-382685914 @rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16443840#comment-16443840 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - rhtyd commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-382685752 @blueorangutan package This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16443715#comment-16443715 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - brettKK commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-382650522 @DaanHoogland , sry, I couldn't get your mean. we can't merge CLOUDSTACK-10356 to apache:master. Only some authoried guys can do that operation This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16443714#comment-16443714 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - brettKK commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-382650522 @DaanHoogland , sry, I couldn't get your mean. we can't merge CLOUDSTACK-10356 to apache:master. Only some authoried guys can do that operation This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16443713#comment-16443713 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - brettKK commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-382650522 @DaanHoogland , sry, I couldn't get your mean. we can't merge CLOUDSTACK-10356 to apache:master. Only the some authoried guys can do that operation This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16443698#comment-16443698 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - lujiefsi commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-382647225 merge to master is better? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16443680#comment-16443680 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - DaanHoogland commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-382645213 so @brettKK @lujiefsi @rafaelweingartner (@rhtyd @swill @wido ) and of course all others are we waiting for this to be rebased against 4.11 or do we merge to master? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16442352#comment-16442352 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - lujiefsi commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-382356636 After checking the output of jenkins, the error is we only delete updateDomainCount in ResourceCountDaoImpl . We also need to delete the method updateDomainCount in ResourceCountDao, which is also @Deprecated This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16442350#comment-16442350 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - lujiefsi commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-382356636 We should also need to delete the method updateDomainCount in ResourceCountDao, which is also @Deprecated This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16442341#comment-16442341 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - brettKK opened a new pull request #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573 @lujiefsi found a potential NPE in Cloudstack --- We have developed a static analysis tool NPEDetector to find some potential NPE. Our analysis shows that some callees may return null in corner case(e.g. node crash , IO exception), some of their callers have !=null check but some do not have. In this issue we post a patch which can add !=null based on existed !=null check. For example: Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: ``` protected GslbServiceProvider lookupGslbServiceProvider() { return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may return null; } ``` Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have !=null: ``` private boolean checkGslbServiceEnabledInZone(long zoneId, long physicalNetworkId) { GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); if (gslbProvider == null) { throw new CloudRuntimeException("No GSLB provider is available"); } return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); } ``` but another GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does not have !=null check: ``` GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); . ``` So we will add below code in non-(!=null) caller GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig ``` if (gslbProvider == null) { throw new CloudRuntimeException("No GSLB provider is available"); } ``` But due to we are not very familiar with CLOUDSTACK, hope some expert can review it. Thanks. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16442340#comment-16442340 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - DaanHoogland commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-382353436 trying to get a new ci run This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16442337#comment-16442337 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - DaanHoogland commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-382353181 @lujiefsi what do you mean by, "does not associate"? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix Some Potential NPE > --- > > Key: CLOUDSTACK-10356 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) >Affects Versions: 4.12.0.0 >Reporter: lujie >Priority: Major > Attachments: CLOUDSTACK-10356_1.patch > > > We have developed a static analysis tool > [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential > NPE. Our analysis shows that some callees may return null in corner case(e.g. > node crash , IO exception), some of their callers have _!=null_ check but > some do not have. In this issue we post a patch which can add !=null based > on existed !=null check. For example: > Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider: > {code:java} > protected GslbServiceProvider lookupGslbServiceProvider() { > return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may > return null; > } > {code} > Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have > _!=null_: > {code:java} > private boolean checkGslbServiceEnabledInZone(long zoneId, long > physicalNetworkId) { >GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); >if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); >} >return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId); > } > {code} > but another > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does > not have !=null check: > {code:java} > GslbServiceProvider gslbProvider = lookupGslbServiceProvider(); > siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId)); > .{code} > So we will add below code in non-(!=null) caller > GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig > {code:java} > if (gslbProvider == null) { > throw new CloudRuntimeException("No GSLB provider is available"); > } > {code} > But due to we are not very familiar with CLOUDSTACK, hope some expert can > review it. > Thanks -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE
[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16442338#comment-16442338 ] ASF GitHub Bot commented on CLOUDSTACK-10356: - DaanHoogland closed pull request #2573: [CLOUDSTACK-10356] Fix NPE in Cloudstack found with NPEDetector URL: https://github.com/apache/cloudstack/pull/2573 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java index f02fdc495f9..c8279ff3f99 100644 --- a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java +++ b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java @@ -499,6 +499,9 @@ public VolumeInfo copyVolumeFromSecToPrimary(VolumeInfo volume, VirtualMachine v // Find a suitable storage to create volume on StoragePool destPool = findStoragePool(dskCh, dc, pod, clusterId, null, vm, avoidPools); +if (destPool == null) { +throw new CloudRuntimeException("Failed to find a suitable storage pool to create Volume in the pod/cluster of the provided VM "+ vm.getUuid()); +} DataStore destStore = dataStoreMgr.getDataStore(destPool.getId(), DataStoreRole.Primary); AsyncCallFuture future = volService.copyVolume(volume, destStore); diff --git a/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDaoImpl.java b/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDaoImpl.java index 56261337faf..dbf2228183b 100644 --- a/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDaoImpl.java @@ -120,16 +120,6 @@ public void setResourceCount(long ownerId, ResourceOwnerType ownerType, Resource } } -@Override -@Deprecated -public void updateDomainCount(long domainId, ResourceType type, boolean increment, long delta) { -delta = increment ? delta : delta * -1; - -ResourceCountVO resourceCountVO = findByOwnerAndType(domainId, ResourceOwnerType.Domain, type); -resourceCountVO.setCount(resourceCountVO.getCount() + delta); -update(resourceCountVO.getId(), resourceCountVO); -} - @Override public boolean updateById(long id, boolean increment, long delta) { delta = increment ? delta : delta * -1; diff --git a/plugins/deployment-planners/implicit-dedication/src/main/java/com/cloud/deploy/ImplicitDedicationPlanner.java b/plugins/deployment-planners/implicit-dedication/src/main/java/com/cloud/deploy/ImplicitDedicationPlanner.java index 5bad9226eed..45f16abd2af 100644 --- a/plugins/deployment-planners/implicit-dedication/src/main/java/com/cloud/deploy/ImplicitDedicationPlanner.java +++ b/plugins/deployment-planners/implicit-dedication/src/main/java/com/cloud/deploy/ImplicitDedicationPlanner.java @@ -39,6 +39,7 @@ import com.cloud.utils.NumbersUtil; import com.cloud.vm.VMInstanceVO; import com.cloud.vm.VirtualMachineProfile; +import org.springframework.util.CollectionUtils; public class ImplicitDedicationPlanner extends FirstFitPlanner implements DeploymentClusterPlanner { @@ -256,14 +257,15 @@ public PlannerResourceUsage getResourceUsage(VirtualMachineProfile vmProfile, De // Get the list of all the hosts in the given clusters List allHosts = new ArrayList(); -for (Long cluster : clusterList) { -List hostsInCluster = resourceMgr.listAllHostsInCluster(cluster); -for (HostVO hostVO : hostsInCluster) { +if (!CollectionUtils.isEmpty(clusterList)) { +for (Long cluster : clusterList) { +List hostsInCluster = resourceMgr.listAllHostsInCluster(cluster); +for (HostVO hostVO : hostsInCluster) { -allHosts.add(hostVO.getId()); +allHosts.add(hostVO.getId()); +} } } - // Go over all the hosts in the cluster and get a list of // 1. All empty hosts, not running any vms. // 2. Hosts running vms for this account and created by a service diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java index dd039e54263..bd639fb76ba