You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2014/07/28 16:04:47 UTC

[35/50] git commit: updated refs/heads/4.4 to d5220a8

Fixed failing DatabaseAccessObject unit test cases

Signed-off-by: Daan Hoogland <da...@onecht.net>
(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 <sa...@gmail.com>
Authored: Mon Jun 23 16:22:46 2014 +0530
Committer: Daan Hoogland <da...@onecht.net>
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;
     }