You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2015/06/18 12:13:42 UTC
git commit: updated refs/heads/master to ba5b6b1
Repository: cloudstack
Updated Branches:
refs/heads/master 897ea3db7 -> ba5b6b152
findbugs: deal with all the encoding issues in a unified way further getBytes() calls can getBytes(StringUtils.getPrefferedCharset()) instead
Signed-off-by: Daan Hoogland <da...@gmail.com>
This closes #467
This closes #467
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ba5b6b15
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ba5b6b15
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ba5b6b15
Branch: refs/heads/master
Commit: ba5b6b152e7c4a9fe8140b79d4bc38e900cdaab1
Parents: 897ea3d
Author: Daan Hoogland <da...@gmail.com>
Authored: Wed Jun 17 10:47:03 2015 +0200
Committer: Daan Hoogland <da...@gmail.com>
Committed: Thu Jun 18 12:13:26 2015 +0200
----------------------------------------------------------------------
utils/src/com/cloud/utils/StringUtils.java | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ba5b6b15/utils/src/com/cloud/utils/StringUtils.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/StringUtils.java b/utils/src/com/cloud/utils/StringUtils.java
index 74dbd4d..73b49fc 100644
--- a/utils/src/com/cloud/utils/StringUtils.java
+++ b/utils/src/com/cloud/utils/StringUtils.java
@@ -19,6 +19,7 @@
package com.cloud.utils;
+import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -32,6 +33,21 @@ import org.owasp.esapi.StringUtilities;
public class StringUtils {
private static final char[] hexChar = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
+ private static Charset preferredACSCharset;
+
+ {
+ String preferredCharset = "UTF-8";
+ if (Charset.isSupported(preferredCharset)) {
+ preferredACSCharset = Charset.forName(preferredCharset);
+ } else {
+ preferredACSCharset = Charset.defaultCharset();
+ }
+ }
+
+ public static Charset getPreferredCharset() {
+ return preferredACSCharset;
+ }
+
public static String join(Iterable<? extends Object> iterable, String delim) {
StringBuilder sb = new StringBuilder();
if (iterable != null) {