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

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


The following commit(s) were added to refs/heads/4.11 by this push:
     new b60daf7  server: Fix exception while update domain resource count 
(#3204)
b60daf7 is described below

commit b60daf7142c337d4a9a9401de6f0a59454be0662
Author: ustcweizhou <[email protected]>
AuthorDate: Mon Apr 29 08:51:08 2019 +0200

    server: Fix exception while update domain resource count (#3204)
---
 .../src/com/cloud/configuration/dao/ResourceCountDaoImpl.java      | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/engine/schema/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java 
b/engine/schema/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java
index 1de2b65..8290310 100644
--- a/engine/schema/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java
+++ b/engine/schema/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java
@@ -276,17 +276,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