cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raj...@apache.org
Subject [3/4] git commit: updated refs/heads/systemvm-build to 884579c
Date Tue, 15 Sep 2015 16:22:20 GMT
Revert "Merge pull request #825 from borisroman/charset"

This reverts commit a44e2bff7ec0c1548d89722c40488746454adce1, reversing
changes made to 06cefaf493423c953a95ee92482a2d0a20a21095.

We are reverting the PR #825 because it breaks Master.


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

Branch: refs/heads/systemvm-build
Commit: 6e426fa46d8cda50ec76f33429320d4590701678
Parents: a44e2bf
Author: wilderrodrigues <wrodrigues@schubergphilis.com>
Authored: Tue Sep 15 14:58:18 2015 +0200
Committer: wilderrodrigues <wrodrigues@schubergphilis.com>
Committed: Tue Sep 15 14:58:18 2015 +0200

----------------------------------------------------------------------
 .../discoverer/HypervServerDiscoverer.java      |  8 +-
 .../resource/HypervDirectConnectResource.java   | 15 ++--
 .../network/bigswitch/BigSwitchBcfApi.java      |  4 +-
 .../cloud/network/brocade/BrocadeVcsApi.java    | 24 ++++--
 .../network/manager/NuageVspManagerImpl.java    |  5 +-
 .../org/apache/cloudstack/saml/SAMLUtils.java   | 82 ++++++++++----------
 .../com/cloud/utils/ConstantTimeComparator.java |  2 +-
 .../com/cloud/utils/storage/QCOW2UtilsTest.java |  5 +-
 8 files changed, 78 insertions(+), 67 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e426fa4/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/discoverer/HypervServerDiscoverer.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/discoverer/HypervServerDiscoverer.java
b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/discoverer/HypervServerDiscoverer.java
index 7fb757d..c928124 100644
--- a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/discoverer/HypervServerDiscoverer.java
+++ b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/discoverer/HypervServerDiscoverer.java
@@ -19,6 +19,7 @@ package com.cloud.hypervisor.hyperv.discoverer;
 import java.net.InetAddress;
 import java.net.URI;
 import java.net.UnknownHostException;
+import java.nio.charset.Charset;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -42,8 +43,8 @@ import com.cloud.agent.api.SetupAnswer;
 import com.cloud.agent.api.SetupCommand;
 import com.cloud.agent.api.StartupCommand;
 import com.cloud.agent.api.StartupRoutingCommand;
-import com.cloud.alert.AlertManager;
 import com.cloud.configuration.Config;
+import com.cloud.alert.AlertManager;
 import com.cloud.dc.ClusterVO;
 import com.cloud.dc.DataCenterVO;
 import com.cloud.dc.HostPodVO;
@@ -65,7 +66,6 @@ import com.cloud.resource.ResourceStateAdapter;
 import com.cloud.resource.ServerResource;
 import com.cloud.resource.UnableDeleteHostException;
 import com.cloud.storage.StorageLayer;
-import com.cloud.utils.StringUtils;
 
 /**
  * Methods to discover and managem a Hyper-V agent. Prepares a
@@ -256,7 +256,7 @@ public class HypervServerDiscoverer extends DiscovererBase implements
Discoverer
             // pool in the database
             // This GUID may change.
             if (cluster.getGuid() == null) {
-                cluster.setGuid(UUID.nameUUIDFromBytes(String.valueOf(clusterId).getBytes(StringUtils.getPreferredCharset())).toString());
+                cluster.setGuid(UUID.nameUUIDFromBytes(String.valueOf(clusterId).getBytes(Charset.forName("UTF-8"))).toString());
                 _clusterDao.update(clusterId, cluster);
             }
 
@@ -322,7 +322,7 @@ public class HypervServerDiscoverer extends DiscovererBase implements
Discoverer
      * @return GUID in form of a string.
      */
     public static String calcServerResourceGuid(final String uuidSeed) {
-        String guid = UUID.nameUUIDFromBytes(uuidSeed.getBytes(StringUtils.getPreferredCharset())).toString();
+        String guid = UUID.nameUUIDFromBytes(uuidSeed.getBytes(Charset.forName("UTF-8"))).toString();
         return guid;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e426fa4/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
index 13586b3..17c5708 100644
--- a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
+++ b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
@@ -24,6 +24,7 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.nio.channels.SocketChannel;
+import java.nio.charset.Charset;
 import java.rmi.RemoteException;
 import java.security.KeyManagementException;
 import java.security.KeyStoreException;
@@ -42,7 +43,6 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
-import org.apache.cloudstack.storage.command.CopyCommand;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.http.HttpResponse;
@@ -62,6 +62,11 @@ import org.apache.http.impl.conn.BasicClientConnectionManager;
 import org.apache.http.util.EntityUtils;
 import org.apache.log4j.Logger;
 
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+
+import org.apache.cloudstack.storage.command.CopyCommand;
+
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.CheckRouterAnswer;
 import com.cloud.agent.api.CheckRouterCommand;
@@ -151,8 +156,6 @@ import com.cloud.utils.ssh.SshHelper;
 import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachine.PowerState;
 import com.cloud.vm.VirtualMachineName;
-import com.google.gson.Gson;
-import com.google.gson.reflect.TypeToken;
 
 
 /**
@@ -650,7 +653,7 @@ public class HypervDirectConnectResource extends ServerResourceBase implements
S
     public ExecutionResult createFileInVR(String routerIp, String filePath, String fileName,
String content) {
         File keyFile = getSystemVMKeyFile();
         try {
-            SshHelper.scpTo(routerIp, 3922, "root", keyFile, null, filePath, content.getBytes(StringUtils.getPreferredCharset()),
fileName, null);
+            SshHelper.scpTo(routerIp, 3922, "root", keyFile, null, filePath, content.getBytes(Charset.forName("UTF-8")),
fileName, null);
         } catch (Exception e) {
             s_logger.warn("Fail to create file " + filePath + fileName + " in VR " + routerIp,
e);
             return new ExecutionResult(false, e.getMessage());
@@ -1315,7 +1318,7 @@ public class HypervDirectConnectResource extends ServerResourceBase
implements S
         }
 
         try {
-            SshHelper.scpTo(controlIp, DEFAULT_DOMR_SSHPORT, "root", keyFile, null, "/tmp/",
tmpCfgFileContents.toString().getBytes(StringUtils.getPreferredCharset()), routerIp.replace('.',
'_') +
+            SshHelper.scpTo(controlIp, DEFAULT_DOMR_SSHPORT, "root", keyFile, null, "/tmp/",
tmpCfgFileContents.toString().getBytes(Charset.forName("UTF-8")), routerIp.replace('.', '_')
+
                     ".cfg", null);
 
             try {
@@ -1512,7 +1515,7 @@ public class HypervDirectConnectResource extends ServerResourceBase
implements S
         String json = new Gson().toJson(data);
         s_logger.debug("VM data JSON IS:" + json);
 
-        json = Base64.encodeBase64String(json.getBytes(StringUtils.getPreferredCharset()));
+        json = Base64.encodeBase64String(json.getBytes(Charset.forName("UTF-8")));
 
         String args = "-d " + json;
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e426fa4/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java
b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java
index 82571e3..16cb3f7 100644
--- a/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java
+++ b/plugins/network-elements/bigswitch/src/com/cloud/network/bigswitch/BigSwitchBcfApi.java
@@ -24,6 +24,7 @@ import java.io.UnsupportedEncodingException;
 import java.lang.reflect.Type;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -48,7 +49,6 @@ import org.apache.commons.httpclient.protocol.Protocol;
 import org.apache.commons.httpclient.protocol.ProtocolSocketFactory;
 import org.apache.log4j.Logger;
 
-import com.cloud.utils.StringUtils;
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
 
@@ -301,7 +301,7 @@ public class BigSwitchBcfApi {
         }
 
         String authString = username + ":" + password;
-        String encodedAuthString = "Basic " + Base64.encodeBase64String(authString.getBytes(StringUtils.getPreferredCharset()));
+        String encodedAuthString = "Basic " + Base64.encodeBase64String(authString.getBytes(Charset.forName("UTF-8")));
         m.setRequestHeader("Authorization", encodedAuthString);
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e426fa4/plugins/network-elements/brocade-vcs/src/com/cloud/network/brocade/BrocadeVcsApi.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/brocade-vcs/src/com/cloud/network/brocade/BrocadeVcsApi.java
b/plugins/network-elements/brocade-vcs/src/com/cloud/network/brocade/BrocadeVcsApi.java
index ec4e85e..dc111fd 100644
--- a/plugins/network-elements/brocade-vcs/src/com/cloud/network/brocade/BrocadeVcsApi.java
+++ b/plugins/network-elements/brocade-vcs/src/com/cloud/network/brocade/BrocadeVcsApi.java
@@ -23,8 +23,8 @@ import java.io.StringReader;
 import java.io.StringWriter;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.nio.charset.Charset;
 
-import javax.persistence.Basic;
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Marshaller;
@@ -45,9 +45,21 @@ import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.client.DefaultHttpClient;
 import org.apache.log4j.Logger;
 
-import com.cloud.dc.Vlan;
-import com.cloud.utils.StringUtils;
-import com.cloud.utils.cisco.n1kv.vsm.PortProfile;
+import com.cloud.network.schema.interfacevlan.InterfaceVlan;
+import com.cloud.network.schema.interfacevlan.Interface;
+import com.cloud.network.schema.interfacevlan.Vlan;
+import com.cloud.network.schema.portprofile.PortProfile;
+import com.cloud.network.schema.portprofile.PortProfile.Activate;
+import com.cloud.network.schema.portprofile.PortProfile.Static;
+import com.cloud.network.schema.portprofile.PortProfileGlobal;
+import com.cloud.network.schema.portprofile.VlanProfile;
+import com.cloud.network.schema.portprofile.VlanProfile.Switchport;
+import com.cloud.network.schema.portprofile.VlanProfile.Switchport.Mode;
+import com.cloud.network.schema.portprofile.VlanProfile.Switchport.Trunk;
+import com.cloud.network.schema.portprofile.VlanProfile.Switchport.Trunk.Allowed;
+import com.cloud.network.schema.portprofile.VlanProfile.SwitchportBasic;
+import com.cloud.network.schema.portprofile.VlanProfile.SwitchportBasic.Basic;
+import com.cloud.network.schema.showvcs.Output;
 
 public class BrocadeVcsApi {
     private static final Logger s_logger = Logger.getLogger(BrocadeVcsApi.class);
@@ -449,7 +461,7 @@ public class BrocadeVcsApi {
             throw new BrocadeVcsApiException("Failed to retreive status : " + errorMessage);
         }
 
-        try (BufferedReader br = new BufferedReader(new InputStreamReader(response.getEntity().getContent(),
StringUtils.getPreferredCharset()))) {
+        try (BufferedReader br = new BufferedReader(new InputStreamReader(response.getEntity().getContent(),
Charset.forName("UTF-8")))) {
             sb = new StringBuffer();
 
             while (((readLine = br.readLine()) != null)) {
@@ -519,7 +531,7 @@ public class BrocadeVcsApi {
 
         if ("text/html".equals(response.getEntity().getContentType().getValue())) {
 
-            try (BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent(),
StringUtils.getPreferredCharset()))) {
+            try (BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent(),
Charset.forName("UTF-8")))) {
 
                 StringBuffer result = new StringBuffer();
                 String line = "";

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e426fa4/plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManagerImpl.java
b/plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManagerImpl.java
index 68ca60f..fed970e 100644
--- a/plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManagerImpl.java
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManagerImpl.java
@@ -19,6 +19,7 @@
 
 package com.cloud.network.manager;
 
+import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -72,7 +73,6 @@ import com.cloud.network.vpc.dao.VpcOfferingServiceMapDao;
 import com.cloud.resource.ResourceManager;
 import com.cloud.resource.ResourceState;
 import com.cloud.resource.ServerResource;
-import com.cloud.utils.StringUtils;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.db.TransactionCallback;
@@ -159,7 +159,7 @@ public class NuageVspManagerImpl extends ManagerBase implements NuageVspManager,
         params.put("name", "Nuage VSD - " + cmd.getHostName());
         params.put("hostname", cmd.getHostName());
         params.put("cmsuser", cmd.getUserName());
-        String cmsUserPasswordBase64 = org.apache.commons.codec.binary.StringUtils.newStringUtf8(Base64.encodeBase64(cmd.getPassword().getBytes(StringUtils.getPreferredCharset())));
+        String cmsUserPasswordBase64 = org.apache.commons.codec.binary.StringUtils.newStringUtf8(Base64.encodeBase64(cmd.getPassword().getBytes(Charset.forName("UTF-8"))));
         params.put("cmsuserpass", cmsUserPasswordBase64);
         int port = cmd.getPort();
         if (0 == port) {
@@ -301,7 +301,6 @@ public class NuageVspManagerImpl extends ManagerBase implements NuageVspManager,
 
         if (numOfSyncThreads != null && syncUpIntervalInMinutes != null) {
             ThreadFactory threadFactory = new ThreadFactory() {
-                @Override
                 public Thread newThread(Runnable runnable) {
                     Thread thread = new Thread(runnable, "Nuage Vsp sync task");
                     if (thread.isDaemon())

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e426fa4/plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAMLUtils.java
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAMLUtils.java
b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAMLUtils.java
index 42419c8..ec6b2c1 100644
--- a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAMLUtils.java
+++ b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAMLUtils.java
@@ -19,42 +19,7 @@
 
 package org.apache.cloudstack.saml;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.io.UnsupportedEncodingException;
-import java.math.BigInteger;
-import java.net.URLEncoder;
-import java.security.InvalidKeyException;
-import java.security.KeyFactory;
-import java.security.KeyPair;
-import java.security.KeyPairGenerator;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-import java.security.SecureRandom;
-import java.security.Security;
-import java.security.Signature;
-import java.security.SignatureException;
-import java.security.cert.CertificateEncodingException;
-import java.security.cert.X509Certificate;
-import java.security.spec.InvalidKeySpecException;
-import java.security.spec.PKCS8EncodedKeySpec;
-import java.security.spec.X509EncodedKeySpec;
-import java.util.List;
-import java.util.zip.Deflater;
-import java.util.zip.DeflaterOutputStream;
-
-import javax.security.auth.x500.X500Principal;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.stream.FactoryConfigurationError;
-
+import com.cloud.utils.HttpUtils;
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.response.LoginCmdResponse;
 import org.apache.log4j.Logger;
@@ -98,8 +63,41 @@ import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.xml.sax.SAXException;
 
-import com.cloud.utils.HttpUtils;
-import com.cloud.utils.StringUtils;
+import javax.security.auth.x500.X500Principal;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.FactoryConfigurationError;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
+import java.math.BigInteger;
+import java.net.URLEncoder;
+import java.nio.charset.Charset;
+import java.security.InvalidKeyException;
+import java.security.KeyFactory;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.SecureRandom;
+import java.security.Security;
+import java.security.Signature;
+import java.security.SignatureException;
+import java.security.cert.CertificateEncodingException;
+import java.security.cert.X509Certificate;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.security.spec.X509EncodedKeySpec;
+import java.util.List;
+import java.util.zip.Deflater;
+import java.util.zip.DeflaterOutputStream;
 
 public class SAMLUtils {
     public static final Logger s_logger = Logger.getLogger(SAMLUtils.class);
@@ -221,7 +219,7 @@ public class SAMLUtils {
         Deflater deflater = new Deflater(Deflater.DEFLATED, true);
         ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
         DeflaterOutputStream deflaterOutputStream = new DeflaterOutputStream(byteArrayOutputStream,
deflater);
-        deflaterOutputStream.write(requestMessage.getBytes(StringUtils.getPreferredCharset()));
+        deflaterOutputStream.write(requestMessage.getBytes(Charset.forName("UTF-8")));
         deflaterOutputStream.close();
         String encodedRequestMessage = Base64.encodeBytes(byteArrayOutputStream.toByteArray(),
Base64.DONT_BREAK_LINES);
         encodedRequestMessage = URLEncoder.encode(encodedRequestMessage, HttpUtils.UTF_8).trim();
@@ -265,7 +263,7 @@ public class SAMLUtils {
         String url = urlEncodedString + "&SigAlg=" + URLEncoder.encode(opensamlAlgoIdSignature,
HttpUtils.UTF_8);
         Signature signature = Signature.getInstance(javaSignatureAlgorithmName);
         signature.initSign(signingKey);
-        signature.update(url.getBytes(StringUtils.getPreferredCharset()));
+        signature.update(url.getBytes(Charset.forName("UTF-8")));
         String signatureString = Base64.encodeBytes(signature.sign(), Base64.DONT_BREAK_LINES);
         if (signatureString != null) {
             return url + "&Signature=" + URLEncoder.encode(signatureString, HttpUtils.UTF_8);
@@ -289,7 +287,7 @@ public class SAMLUtils {
             KeyFactory keyFactory = SAMLUtils.getKeyFactory();
             if (keyFactory == null) return null;
             X509EncodedKeySpec spec = keyFactory.getKeySpec(key, X509EncodedKeySpec.class);
-            return new String(org.bouncycastle.util.encoders.Base64.encode(spec.getEncoded()),
StringUtils.getPreferredCharset());
+            return new String(org.bouncycastle.util.encoders.Base64.encode(spec.getEncoded()),
Charset.forName("UTF-8"));
         } catch (InvalidKeySpecException e) {
             s_logger.error("Unable to create KeyFactory:" + e.getMessage());
         }
@@ -302,7 +300,7 @@ public class SAMLUtils {
             if (keyFactory == null) return null;
             PKCS8EncodedKeySpec spec = keyFactory.getKeySpec(key,
                     PKCS8EncodedKeySpec.class);
-            return new String(org.bouncycastle.util.encoders.Base64.encode(spec.getEncoded()),
StringUtils.getPreferredCharset());
+            return new String(org.bouncycastle.util.encoders.Base64.encode(spec.getEncoded()),
Charset.forName("UTF-8"));
         } catch (InvalidKeySpecException e) {
             s_logger.error("Unable to create KeyFactory:" + e.getMessage());
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e426fa4/utils/src/main/java/com/cloud/utils/ConstantTimeComparator.java
----------------------------------------------------------------------
diff --git a/utils/src/main/java/com/cloud/utils/ConstantTimeComparator.java b/utils/src/main/java/com/cloud/utils/ConstantTimeComparator.java
index f71143a..baf2bc2 100644
--- a/utils/src/main/java/com/cloud/utils/ConstantTimeComparator.java
+++ b/utils/src/main/java/com/cloud/utils/ConstantTimeComparator.java
@@ -36,7 +36,7 @@ public class ConstantTimeComparator {
     }
 
     public static boolean compareStrings(String s1, String s2) {
-        final Charset encoding = StringUtils.getPreferredCharset();
+        final Charset encoding = Charset.forName("UTF-8");
         return compareBytes(s1.getBytes(encoding), s2.getBytes(encoding));
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e426fa4/utils/src/test/java/com/cloud/utils/storage/QCOW2UtilsTest.java
----------------------------------------------------------------------
diff --git a/utils/src/test/java/com/cloud/utils/storage/QCOW2UtilsTest.java b/utils/src/test/java/com/cloud/utils/storage/QCOW2UtilsTest.java
index dfbade2..92881a6 100644
--- a/utils/src/test/java/com/cloud/utils/storage/QCOW2UtilsTest.java
+++ b/utils/src/test/java/com/cloud/utils/storage/QCOW2UtilsTest.java
@@ -24,12 +24,11 @@ import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
 
 import org.junit.Before;
 import org.junit.Test;
 
-import com.cloud.utils.StringUtils;
-
 public class QCOW2UtilsTest {
 
     InputStream inputStream;
@@ -68,7 +67,7 @@ public class QCOW2UtilsTest {
         ByteBuffer byteBuffer = ByteBuffer.allocate(72);
 
         // Magic
-        byteBuffer.put("QFI".getBytes(StringUtils.getPreferredCharset()));
+        byteBuffer.put("QFI".getBytes(Charset.forName("UTF-8")));
         byteBuffer.put((byte)0xfb);
 
         // Version


Mime
View raw message