You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2015/06/18 12:36:55 UTC

git commit: updated refs/heads/master to b678b47

Repository: cloudstack
Updated Branches:
  refs/heads/master 59e6596fe -> b678b4779


Fix findbugs SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING warning in ConfigurationServerImpl.java

Remove checkstyle reported trailing space

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>

This closes #477


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b678b477
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b678b477
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b678b477

Branch: refs/heads/master
Commit: b678b47793f5d1f54c3ca08b44767b5b83da4e0a
Parents: 59e6596
Author: Rafael da Fonseca <rs...@gmail.com>
Authored: Wed Jun 17 21:09:33 2015 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Thu Jun 18 13:36:44 2015 +0300

----------------------------------------------------------------------
 server/src/com/cloud/server/ConfigurationServerImpl.java | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b678b477/server/src/com/cloud/server/ConfigurationServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java
index a28d984..288eeeb 100644
--- a/server/src/com/cloud/server/ConfigurationServerImpl.java
+++ b/server/src/com/cloud/server/ConfigurationServerImpl.java
@@ -693,12 +693,11 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
             TransactionLegacy txn = TransactionLegacy.currentTxn();
             try {
                 String rpassword = PasswordGenerator.generatePresharedKey(8);
-                String wSql =
-                        "INSERT INTO `cloud`.`configuration` (category, instance, component, name, value, description) " +
-                                "VALUES ('Secure','DEFAULT', 'management-server','system.vm.password', '" + DBEncryptionUtil.encrypt(rpassword) +
-                                "','randmon password generated each management server starts for system vm')";
+                String wSql = "INSERT INTO `cloud`.`configuration` (category, instance, component, name, value, description) "
+                + "VALUES ('Secure','DEFAULT', 'management-server','system.vm.password', ?,'randmon password generated each management server starts for system vm')";
                 PreparedStatement stmt = txn.prepareAutoCloseStatement(wSql);
-                stmt.executeUpdate(wSql);
+                stmt.setString(1, DBEncryptionUtil.encrypt(rpassword));
+                stmt.executeUpdate();
                 s_logger.info("Updated systemvm password in database");
             } catch (SQLException e) {
                 s_logger.error("Cannot retrieve systemvm password", e);