cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajeshbatt...@apache.org
Subject git commit: updated refs/heads/master to b008d78
Date Tue, 18 Nov 2014 08:03:15 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master bfe53d1b2 -> b008d78b5


CLOUDSTACK-7930, CLOUDSTACK-7931: Do not allow to set invalid values for global settings which
are of type integer and float

This closes #41


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

Branch: refs/heads/master
Commit: b008d78b57d318336e8e36091e64d19966ea518b
Parents: bfe53d1
Author: Anshul Gangwar <anshul.gangwar@citrix.com>
Authored: Mon Nov 17 15:27:22 2014 +0530
Committer: Rajesh Battala <rajesh.battala@citrix.com>
Committed: Tue Nov 18 13:36:21 2014 +0530

----------------------------------------------------------------------
 .../configuration/ConfigurationManagerImpl.java      | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b008d78b/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 2ba6ac1..865edf6 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -725,6 +725,21 @@ public class ConfigurationManagerImpl extends ManagerBase implements
Configurati
             type = c.getType();
         }
 
+        String errMsg = null;
+        try {
+            if (type.equals(Integer.class)) {
+                errMsg = "There was error in trying to parse value: " + value + ". Please
enter a valid integer value for parameter " + name;
+                Integer.parseInt(value);
+            } else if (type.equals(Float.class)) {
+                errMsg = "There was error in trying to parse value: " + value + ". Please
enter a valid float value for parameter " + name;
+                Float.parseFloat(value);
+            }
+        } catch (Exception e) {
+            // catching generic exception as some throws NullPointerException and some throws
NumberFormatExcpeion
+            s_logger.error(errMsg);
+            return errMsg;
+        }
+
         if (value == null) {
             if (type.equals(Boolean.class)) {
                 return "Please enter either 'true' or 'false'.";


Mime
View raw message