This is an automated email from the ASF dual-hosted git repository.

dahn pushed a commit to branch reimplement3303on4.12
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/reimplement3303on4.12 by this 
push:
     new 1bb64e5  server: Fix exception while update domain resource count 
(#3204)   reimplement 3303 on moved file in 4.12
1bb64e5 is described below

commit 1bb64e51ff6546284062446ad1b3e8d1c1ebf5df
Author: Daan Hoogland <[email protected]>
AuthorDate: Mon Apr 29 08:20:37 2019 +0000

    server: Fix exception while update domain resource count (#3204)
      reimplement 3303 on moved file in 4.12
---
 .../java/com/cloud/configuration/dao/ResourceCountDaoImpl.java    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDaoImpl.java
 
b/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDaoImpl.java
index 4bd8302..9b6734d 100644
--- 
a/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDaoImpl.java
+++ 
b/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDaoImpl.java
@@ -266,18 +266,18 @@ public class ResourceCountDaoImpl extends 
GenericDaoBase<ResourceCountVO, Long>
     }
 
     private long executeSqlCountComputingResourcesForAccount(long accountId, 
String sqlCountComputingResourcesAllocatedToAccount) {
-        try (TransactionLegacy tx = TransactionLegacy.currentTxn()) {
+        TransactionLegacy tx = TransactionLegacy.currentTxn()
+        try {
             PreparedStatement pstmt = 
tx.prepareAutoCloseStatement(sqlCountComputingResourcesAllocatedToAccount);
             pstmt.setLong(1, accountId);
 
             ResultSet rs = pstmt.executeQuery();
             if (!rs.next()) {
-                throw new CloudRuntimeException(String.format("An unexpected 
case happened while counting allocated computing resources for account: " + 
accountId));
+                return 0L;
             }
             return rs.getLong("total");
         } catch (SQLException e) {
             throw new CloudRuntimeException(e);
         }
     }
-
-}
\ No newline at end of file
+}

Reply via email to