[ https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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 <b>Trillian test result (tid-2528)</b> 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)