[
https://issues.apache.org/jira/browse/CLOUDSTACK-9174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15182692#comment-15182692
]
ASF GitHub Bot commented on CLOUDSTACK-9174:
--------------------------------------------
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)
```
> Quota Service: When a account/user is deleted with low quota, quota service
> still tries to alert the user resulting in NPE
> --------------------------------------------------------------------------------------------------------------------------
>
> Key: CLOUDSTACK-9174
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9174
> Project: CloudStack
> Issue Type: Bug
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Affects Versions: 4.7.0
> Reporter: Abhinandan Prateek
> Assignee: Abhinandan Prateek
> Priority: Critical
> Fix For: 4.8.0
>
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)