cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [1/2] git commit: updated refs/heads/4.5 to f702097
Date Tue, 20 Jan 2015 02:19:45 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.5 960d91e0d -> f702097b3


CID 1264632: Rely on a known and widely available encoding UTF8

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


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

Branch: refs/heads/4.5
Commit: 0763b5576dde92b1c4ecfbce3b3b593ed0ca90bc
Parents: 960d91e
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Tue Jan 20 07:47:34 2015 +0530
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Tue Jan 20 07:47:34 2015 +0530

----------------------------------------------------------------------
 utils/src/com/cloud/utils/ConstantTimeComparator.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0763b557/utils/src/com/cloud/utils/ConstantTimeComparator.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/ConstantTimeComparator.java b/utils/src/com/cloud/utils/ConstantTimeComparator.java
index 4d4a595..baf2bc2 100644
--- a/utils/src/com/cloud/utils/ConstantTimeComparator.java
+++ b/utils/src/com/cloud/utils/ConstantTimeComparator.java
@@ -19,6 +19,8 @@
 
 package com.cloud.utils;
 
+import java.nio.charset.Charset;
+
 public class ConstantTimeComparator {
 
     public static boolean compareBytes(byte[] b1, byte[] b2) {
@@ -34,6 +36,7 @@ public class ConstantTimeComparator {
     }
 
     public static boolean compareStrings(String s1, String s2) {
-        return compareBytes(s1.getBytes(), s2.getBytes());
+        final Charset encoding = Charset.forName("UTF-8");
+        return compareBytes(s1.getBytes(encoding), s2.getBytes(encoding));
     }
 }


Mime
View raw message