cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject git commit: updated refs/heads/master to f5ba020
Date Mon, 14 Apr 2014 17:18:23 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 5e90b75c9 -> f5ba02063


Fix: ParamGenericValidationWorker shouldn't be case sensitive

Signed-off-by: Alena Prokharchyk <alena.prokharchyk@citrix.com>


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

Branch: refs/heads/master
Commit: f5ba020633d4152a9eeab59b5a5af4285c9834e4
Parents: 5e90b75
Author: Antonio Fornie <afornie@schubergphilis.com>
Authored: Wed Apr 9 08:46:53 2014 -0500
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Mon Apr 14 10:05:19 2014 -0700

----------------------------------------------------------------------
 .../api/dispatch/ParamGenericValidationWorker.java    | 14 +++++++++++---
 .../dispatch/ParamGenericValidationWorkerTest.java    |  4 ++++
 2 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f5ba0206/server/src/com/cloud/api/dispatch/ParamGenericValidationWorker.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/dispatch/ParamGenericValidationWorker.java b/server/src/com/cloud/api/dispatch/ParamGenericValidationWorker.java
index 7a73b8a..d6b0cf2 100644
--- a/server/src/com/cloud/api/dispatch/ParamGenericValidationWorker.java
+++ b/server/src/com/cloud/api/dispatch/ParamGenericValidationWorker.java
@@ -80,9 +80,17 @@ public class ParamGenericValidationWorker implements DispatchWorker {
 
         final StringBuilder errorMsg = new StringBuilder(ERROR_MSG_PREFIX);
         boolean foundUnknownParam = false;
-        for (final Object paramName : params.keySet()) {
-            if (!expectedParamNames.contains(paramName)) {
-                errorMsg.append(" ").append(paramName);
+        for (final Object actualParamName : params.keySet()) {
+            // If none of the expected params matches, we have an unknown param
+            boolean matchedCurrentParam = false;
+            for (final String expectedName : expectedParamNames) {
+                if (expectedName.equalsIgnoreCase((String) actualParamName)) {
+                    matchedCurrentParam = true;
+                    break;
+                }
+            }
+            if (!matchedCurrentParam) {
+                errorMsg.append(" ").append(actualParamName);
                 foundUnknownParam= true;
             }
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f5ba0206/server/test/com/cloud/api/dispatch/ParamGenericValidationWorkerTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/api/dispatch/ParamGenericValidationWorkerTest.java b/server/test/com/cloud/api/dispatch/ParamGenericValidationWorkerTest.java
index 8f9709c..3073c7f 100644
--- a/server/test/com/cloud/api/dispatch/ParamGenericValidationWorkerTest.java
+++ b/server/test/com/cloud/api/dispatch/ParamGenericValidationWorkerTest.java
@@ -95,6 +95,10 @@ public class ParamGenericValidationWorkerTest {
         params.put(ApiConstants.SIGNATURE, "");
         params.put(ApiConstants.CTX_ACCOUNT_ID, "");
         params.put(ApiConstants.CTX_START_EVENT_ID, "");
+        // Make sure it's case insensitive
+        params.put(ApiConstants.CTX_START_EVENT_ID, "");
+        params.put(ApiConstants.CTX_START_EVENT_ID.toLowerCase(), "");
+        params.put(ApiConstants.CTX_USER_ID.toUpperCase(), "");
         params.put(ApiConstants.CTX_USER_ID, "");
         params.put(ApiConstants.UUID, "");
         params.put(ApiConstants.ID, "");


Mime
View raw message