You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by sa...@apache.org on 2014/06/10 15:01:52 UTC

git commit: updated refs/heads/4.4-forward to 5bcd017

Repository: cloudstack
Updated Branches:
  refs/heads/4.4-forward c5ee5ad5c -> 5bcd017de


CLOUDSTACK-6654: Configkey parameters are not validated


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

Branch: refs/heads/4.4-forward
Commit: 5bcd017de6f421a6125406120b39fb8602276dc7
Parents: c5ee5ad
Author: Saksham Srivastava <sa...@citrix.com>
Authored: Tue Jun 10 18:27:54 2014 +0530
Committer: Saksham Srivastava <sa...@citrix.com>
Committed: Tue Jun 10 18:27:54 2014 +0530

----------------------------------------------------------------------
 .../configuration/ConfigurationManagerImpl.java  | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5bcd017d/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index 0dc067a..1549e12 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -701,12 +701,19 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
                 return "Invalid scope id provided for the parameter " + name;
             }
         }
+        Class<?> type = null;
         Config c = Config.getConfig(name);
         if (c == null) {
-            s_logger.warn("Did not find configuration " + name + " in Config.java. Perhaps moved to ConfigDepot?");
-            return null;
+            s_logger.warn("Did not find configuration " + name + " in Config.java. Perhaps moved to ConfigDepot");
+            ConfigKey<?> configKey = _configDepot.get(name);
+            if(configKey == null) {
+                s_logger.warn("Did not find configuration " + name + " in ConfigDepot too.");
+                return null;
+            }
+            type = configKey.type();
+        } else {
+            type = c.getType();
         }
-        Class<?> type = c.getType();
 
         if (value == null) {
             if (type.equals(Boolean.class)) {
@@ -765,6 +772,12 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
             }
         }
 
+        if(c == null ) {
+            //range validation has to be done per case basis, for now
+            //return in case of Configkey parameters
+            return null;
+        }
+
         String range = c.getRange();
         if (range == null) {
             return null;