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 299A1117D4 for ; Mon, 28 Jul 2014 14:04:30 +0000 (UTC) Received: (qmail 98963 invoked by uid 500); 28 Jul 2014 14:04:15 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 98912 invoked by uid 500); 28 Jul 2014 14:04:15 -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 98436 invoked by uid 99); 28 Jul 2014 14:04:15 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Jul 2014 14:04:15 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id DF3DE9B7C8B; Mon, 28 Jul 2014 14:04:14 +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: Mon, 28 Jul 2014 14:04:47 -0000 Message-Id: <56266775a69649f0b91e651237c385d7@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [35/50] git commit: updated refs/heads/4.4 to d5220a8 Fixed failing DatabaseAccessObject unit test cases Signed-off-by: Daan Hoogland (cherry picked from commit ff46258022a4f61f05f8c011fa7dbe68175770df) Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2eae404c Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2eae404c Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2eae404c Branch: refs/heads/4.4 Commit: 2eae404cf7dc2e706407bb254335749b5b7defcd Parents: eb16a4e Author: Santhosh Edukulla Authored: Mon Jun 23 16:22:46 2014 +0530 Committer: Daan Hoogland Committed: Mon Jul 28 16:02:43 2014 +0200 ---------------------------------------------------------------------- .../com/cloud/upgrade/dao/DatabaseAccessObject.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2eae404c/engine/schema/src/com/cloud/upgrade/dao/DatabaseAccessObject.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/upgrade/dao/DatabaseAccessObject.java b/engine/schema/src/com/cloud/upgrade/dao/DatabaseAccessObject.java index 4cc88bd..1e620a5 100644 --- a/engine/schema/src/com/cloud/upgrade/dao/DatabaseAccessObject.java +++ b/engine/schema/src/com/cloud/upgrade/dao/DatabaseAccessObject.java @@ -39,7 +39,8 @@ public class DatabaseAccessObject { pstmt.executeUpdate(); s_logger.debug("Key " + key + " is dropped successfully from the table " + tableName); } catch (SQLException e) { - s_logger.warn("dropKey:Exception:"+e.getMessage()); + s_logger.warn("Ignored SQL Exception when trying to drop " + (isForeignKey ? "foreign " : "") + "key " + key + " on table " + tableName, e); + } } @@ -47,8 +48,8 @@ public class DatabaseAccessObject { try(PreparedStatement pstmt = conn.prepareStatement("ALTER TABLE " + tableName + " DROP PRIMARY KEY ");) { pstmt.executeUpdate(); s_logger.debug("Primary key is dropped successfully from the table " + tableName); - } catch (Exception e) { - s_logger.warn("dropPrimaryKey:Exception:"+e.getMessage()); + } catch (SQLException e) { + s_logger.warn("Ignored SQL Exception when trying to drop primary key on table " + tableName, e); } } @@ -56,8 +57,8 @@ public class DatabaseAccessObject { try (PreparedStatement pstmt = conn.prepareStatement("ALTER TABLE " + tableName + " DROP COLUMN " + columnName);){ pstmt.executeUpdate(); s_logger.debug("Column " + columnName + " is dropped successfully from the table " + tableName); - } catch (Exception e) { - s_logger.warn("dropColumn:Exception:"+e.getMessage()); + } catch (SQLException e) { + s_logger.warn("Unable to drop column " + columnName + " due to exception", e); } } @@ -66,8 +67,8 @@ public class DatabaseAccessObject { try (PreparedStatement pstmt = conn.prepareStatement("SELECT " + columnName + " FROM " + tableName);){ pstmt.executeQuery(); columnExists = true; - } catch (Exception e) { - s_logger.warn("columnExists:Exception:"+e.getMessage()); + } catch (SQLException e) { + s_logger.warn("Field " + columnName + " doesn't exist in " + tableName, e); } return columnExists; }