Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.12.0.0
    • 4.12
    • None
    • Security Level: Public (Anyone can view this level - this is the default.)
    • None

    Description

      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!!!!

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              xiaoheipangzi lujie
              Votes:
              0 Vote for this issue
              Watchers:
              4 Stop watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Slack

                  Issue deployment