You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2022/12/21 13:39:26 UTC

[GitHub] [cloudstack] weizhouapache commented on a diff in pull request #7003: utils,framework/db: Introduce new database encryption cipher based on AesGcmJce

weizhouapache commented on code in PR #7003:
URL: https://github.com/apache/cloudstack/pull/7003#discussion_r1054400361


##########
engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java:
##########
@@ -417,11 +417,12 @@ private void initializeDatabaseEncryptors() {
 
             errorMessage = "Unable to get the 'init' value from 'configuration' table in the 'cloud' database";
             String sql = "SELECT value from configuration WHERE name = 'init'";
-            PreparedStatement pstmt = conn.prepareStatement(sql);
-            ResultSet result = pstmt.executeQuery();
-            if (result.next()) {
-                String init = result.getString(1);
-                s_logger.info("init = " + DBEncryptionUtil.decrypt(init));
+            try (PreparedStatement pstmt = conn.prepareStatement(sql);
+                 ResultSet result = pstmt.executeQuery()) {
+                if (result.next()) {
+                    String init = result.getString(1);
+                    s_logger.info("init = " + DBEncryptionUtil.decrypt(init));
+                }

Review Comment:
   make sense. done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org