Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AF17918ABB for ; Thu, 9 Jul 2015 19:30:45 +0000 (UTC) Received: (qmail 71947 invoked by uid 500); 9 Jul 2015 19:30:45 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 71865 invoked by uid 500); 9 Jul 2015 19:30:45 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 71696 invoked by uid 99); 9 Jul 2015 19:30:45 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Jul 2015 19:30:45 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id F3765E6839; Thu, 9 Jul 2015 19:30:44 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: dahn@apache.org To: commits@cloudstack.apache.org Date: Thu, 09 Jul 2015 19:30:45 -0000 Message-Id: In-Reply-To: <6d2a519c1d684124acfc84d03c7714d2@git.apache.org> References: <6d2a519c1d684124acfc84d03c7714d2@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [02/10] git commit: updated refs/heads/master to b0136c5 coverity 1116507: one off old upgrade code trivial fix however Signed-off-by: Daan Hoogland Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/79709cd4 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/79709cd4 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/79709cd4 Branch: refs/heads/master Commit: 79709cd490e559e8042c6909c1d60d21fe42d598 Parents: dae2e05 Author: Daan Hoogland Authored: Tue Jul 7 12:52:37 2015 +0200 Committer: Daan Hoogland Committed: Thu Jul 9 21:30:23 2015 +0200 ---------------------------------------------------------------------- .../upgrade/dao/Upgrade222to224Premium.java | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/79709cd4/engine/schema/src/com/cloud/upgrade/dao/Upgrade222to224Premium.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade222to224Premium.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade222to224Premium.java index 921c5e6..775c140 100644 --- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade222to224Premium.java +++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade222to224Premium.java @@ -60,25 +60,25 @@ public class Upgrade222to224Premium extends Upgrade222to224 { } private void updateUserStats(Connection conn) { - try { + try ( // update network_id information + PreparedStatement pstmt = conn.prepareStatement( + "update cloud_usage.user_statistics uus, cloud.user_statistics us set uus.network_id = us.network_id where uus.id = us.id" + ); + ) { - // update network_id information - PreparedStatement pstmt = - conn.prepareStatement("update cloud_usage.user_statistics uus, cloud.user_statistics us set uus.network_id = " + "us.network_id where uus.id = us.id"); pstmt.executeUpdate(); - pstmt.close(); - s_logger.debug("Upgraded cloud_usage user_statistics with networkId"); + } catch (Exception e) { + throw new CloudRuntimeException("Failed to upgrade user stats: ", e); + } - // update network_id information in usage_network - PreparedStatement pstmt1 = - conn.prepareStatement("update cloud_usage.usage_network un, cloud_usage.user_statistics us set un.network_id = " + try ( // update network_id information in usage_network + PreparedStatement pstmt1 = + conn.prepareStatement("update cloud_usage.usage_network un, cloud_usage.user_statistics us set un.network_id = " + "us.network_id where us.account_id = un.account_id and us.data_center_id = un.zone_id and us.device_id = un.host_id"); + ) { pstmt1.executeUpdate(); - pstmt1.close(); - s_logger.debug("Upgraded cloud_usage usage_network with networkId"); - } catch (Exception e) { throw new CloudRuntimeException("Failed to upgrade user stats: ", e); }