Skip to content

Commit fc95ece

Browse files
quota: fixes
1 parent b0a8598 commit fc95ece

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

plugins/database/quota/src/org/apache/cloudstack/api/response/QuotaResponseBuilderImpl.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,15 @@ public int compare(QuotaBalanceVO o1, QuotaBalanceVO o2) {
110110

111111
QuotaBalanceResponse resp = new QuotaBalanceResponse();
112112
BigDecimal lastCredits = new BigDecimal(0);
113-
boolean consecutive = true;
114113
for (Iterator<QuotaBalanceVO> it = quotaBalance.iterator(); it.hasNext();) {
115114
QuotaBalanceVO entry = it.next();
116115
s_logger.info("createQuotaBalanceResponse: Date=" + entry.getUpdatedOn().toGMTString() + " balance=" + entry.getCreditBalance() + " credit=" + entry.getCreditsId());
117116
if (entry.getCreditsId() > 0) {
118-
if (consecutive) {
119-
lastCredits = lastCredits.add(entry.getCreditBalance());
120-
}
117+
lastCredits = lastCredits.add(entry.getCreditBalance());
121118
resp.addCredits(entry);
122119
it.remove();
123120
} else {
124-
consecutive = false;
121+
break;
125122
}
126123
}
127124

@@ -145,7 +142,7 @@ public int compare(QuotaBalanceVO o1, QuotaBalanceVO o2) {
145142
@Override
146143
public QuotaStatementResponse createQuotaStatementResponse(final List<QuotaUsageVO> quotaUsage) {
147144
if (quotaUsage == null || quotaUsage.size() == 0) {
148-
new InvalidParameterValueException("There is no uage data for period mentioned.");
145+
throw new InvalidParameterValueException("There is no uage data for period mentioned.");
149146
}
150147
final short opendb = TransactionLegacy.currentTxn().getDatabaseId();
151148
TransactionLegacy.open(TransactionLegacy.USAGE_DB).close();

0 commit comments

Comments
 (0)