cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject git commit: updated refs/heads/hotfix/CID-1256277 to 5906670
Date Wed, 03 Dec 2014 12:32:46 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/hotfix/CID-1256277 51c74560e -> 590667076 (forced update)


CID-1256277 use StringBuffer in loop


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

Branch: refs/heads/hotfix/CID-1256277
Commit: 590667076d420593e707ba30ff8419c56e5f52b2
Parents: 6dd30ea
Author: Daan Hoogland <dhoogland@schubergphilis.com>
Authored: Wed Dec 3 12:16:24 2014 +0100
Committer: Daan Hoogland <daan@onecht.net>
Committed: Wed Dec 3 13:32:22 2014 +0100

----------------------------------------------------------------------
 server/src/com/cloud/user/AccountManagerImpl.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/59066707/server/src/com/cloud/user/AccountManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java
index b6aa201..983a58a 100644
--- a/server/src/com/cloud/user/AccountManagerImpl.java
+++ b/server/src/com/cloud/user/AccountManagerImpl.java
@@ -1998,6 +1998,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager,
M
             String signature = null;
             long timestamp = 0L;
             String unsignedRequest = null;
+            StringBuffer unsignedRequestBuffer = new StringBuffer();
 
             // - build a request string with sorted params, make sure it's all lowercase
             // - sign the request, verify the signature is the same
@@ -2038,11 +2039,10 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager,
M
                             }
                         }
 
-                        if (unsignedRequest == null) {
-                            unsignedRequest = paramName + "=" + URLEncoder.encode(paramValue,
"UTF-8").replaceAll("\\+", "%20");
-                        } else {
-                            unsignedRequest = unsignedRequest + "&" + paramName + "="
+ URLEncoder.encode(paramValue, "UTF-8").replaceAll("\\+", "%20");
+                        if (unsignedRequestBuffer.length() != 0) {
+                            unsignedRequestBuffer.append("&");
                         }
+                        unsignedRequestBuffer.append(paramName).append("=").append(URLEncoder.encode(paramValue,
"UTF-8"));
                     }
                 }
 
@@ -2053,7 +2053,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager,
M
                     return null;
                 }
 
-                unsignedRequest = unsignedRequest.toLowerCase();
+                unsignedRequest = unsignedRequestBuffer.toString().toLowerCase().replaceAll("\\+",
"%20");
 
                 Mac mac = Mac.getInstance("HmacSHA1");
                 SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(), "HmacSHA1");


Mime
View raw message