Github user alexandrelimassantana commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1254#discussion_r55169349
  
    --- Diff: 
framework/quota/src/org/apache/cloudstack/quota/QuotaManagerImpl.java ---
    @@ -358,10 +358,11 @@ public QuotaUsageVO updateQuotaDiskUsage(UsageVO 
usageRecord, final BigDecimal a
             BigDecimal rawusage;
             // get service offering details
             ServiceOfferingVO serviceoffering = 
_serviceOfferingDao.findServiceOffering(usageRecord.getVmInstanceId(), 
usageRecord.getOfferingId());
    +        if (serviceoffering == null) return quotalist;
             rawusage = new BigDecimal(usageRecord.getRawUsage());
     
             QuotaTariffVO tariff = 
_quotaTariffDao.findTariffPlanByUsageType(QuotaTypes.CPU_NUMBER, 
usageRecord.getEndDate());
    -        if (tariff != null && 
tariff.getCurrencyValue().compareTo(BigDecimal.ZERO) != 0) {
    +        if (tariff != null && 
tariff.getCurrencyValue().compareTo(BigDecimal.ZERO) != 0 && 
serviceoffering.getCpu() != null) {
    --- End diff --
    
    Hello @agneya2001 ,
    
    In the refactor you plan to make, you could also turn this piece of code 
into a method, for reusability:
    ```Java
    tariff != null && tariff.getCurrencyValue().compareTo(BigDecimal.ZERO)
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to